GCC 3.3 release criteria
Mattias Engdegård
mattias@nellie.hq.vtech
Wed Feb 26 11:45:00 GMT 2003
>Yes and no. One section, "an inline function is as fast as a macro",
>implies that a function that's declared inline will always be
>inlined (at least if you're using -O and if the function doesn't use
>constructs that are unsuitable for inlining).
In releases prior to 3.3, inline functions aren't even as fast as macros.
I found out this when converting a bunch of hairy macros to inline functions.
In the cases I tested, gcc 3.3 generated the same code for the macro case
and inline functions, so this has apparently been solved.
A common coding style (at least around here) is to write rather big
and complex inline functions (frequently containing calls to other big
inline functions), assuming that they will collapse to relatively
little code when instantiated, because of constant folding and
dead-code removal. Quite often the resulting code is smaller than the
function call to a non-inlined function.
A -fobey-inline directive sounds like a good compromise for 3.3.
More information about the Gcc
mailing list