>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)iskon.hr> writes:
Hrvoje> Martin Buchholz <martin(a)xemacs.org> writes:
> - no inline support.
> - gcc historic inline support
> - C9x standard inline
> - C++ standard inline
Hrvoje> [...]
> Rule: if you have a static function, and you want to provide a
> special hint for the compiler that this function _really_ should be
> inlined (e.g if the function is known to be very frequently called),
> I think you can currently do that _portably_ in the sources like
> this:
>
> static inline ....
Hrvoje> I've been told that in C++ `inline' means `static inline'. Do all
C++
Hrvoje> compilers grok `static inline'?
In standard C++, `inline' does not affect the extern-ness of a
function. If different translations units have definitions for an
external inline function, they must be identical. Older C++
implementations considered `extern inline' illegal. I guess that adds
to the number of distinct inline implementations - we're up to 6 now!
Yes, in C++ you can have an extern inline function with a static
variable declared within it, and all the inline functions in different
translation units share that static variable!
> As for renaming INLINE to INLINE_HEADER, that does seem like a
safer
> name, but I don't think it's worth making this global change now.
Hrvoje> I think it is. And it's especially important to *document* what it
Hrvoje> means. The annoying thing about the INLINE confusion is that it crops
Hrvoje> up time and again, by different people and with different code.
OK. I'm convinced. I'll implement this, if there are no further
objections.
Again, the proposal:
1. Rename INLINE to INLINE_HEADER.
2. Document the two approved ways of creating inline functions - in
.h files, using INLINE_HEADER, and in .c files, using `static inline'.