[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112828: Merge the specpdl and ba
From: |
Paul Eggert |
Subject: |
Re: [Emacs-diffs] /srv/bzr/emacs/trunk r112828: Merge the specpdl and backtrace stacks. Make the structure of the |
Date: |
Mon, 03 Jun 2013 22:55:18 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
On 06/03/2013 12:23 PM, Eli Zaretskii wrote:
> Perhaps Paul could describe that nonetheless.
Where's a good place to put the description? Here's a quick first cut:
* C code ordinarily shouldn't use 'inline'. Ordinarily, we let
the compiler figure out whether to inline. Compilers are
pretty good about it these days.
* There's an exception for functions defined (not merely declared)
in .h files. Here, if we avoid inline we'll suffer from code bloat.
Suppose aaa.h defines the function foo, and aaa.c, bbb.c and ccc.c
all include aaa.h. foo can't be an ordinary extern function, as it'd
be defined three times and the definitions would clash. foo could be
a static function, but with separate compilation if foo's not inlined
then foo's code will appear in the executable three times. To avoid
this code bloat, aaa.h can do this:
INLINE_HEADER_BEGIN
#ifndef AAA_INLINE
# define AAA_INLINE INLINE
#endif
AAA_INLINE int foo (int i) { return i + 1; }
INLINE_HEADER_END
On C99 hosts this expands to C99-style 'extern inline' usage that avoids
the code bloat. (Pre-C99 hosts still suffer from code bloat, but that's
acceptable; they're not mainline platforms and they'll die out eventually.)