Problems with inline functions
George Anzinger
george@pioneer.net
Mon Aug 28 18:49:00 GMT 2000
Geoff Keating wrote:
>
> George Anzinger <george@pioneer.net> writes:
>
> > ... I think it would be nice to defer compiling
> > inline functions until they are actually used in normal code. This
> > would make writing header files that have inline functions MUCH easier
> > to manage.
>
> This would violate the C standard. The diagnostics you're seeing are
> required.
Then the C standard says something like "non-locals in an inline
function are references to the environment that exists at the time the
function "appears" in the source stream"? This sounds confusing to me,
however, given that the standard says what it does, is there some neat
trick (short of using macros) that will get the desired effect? I have
come across cases where it was impossible to get the correct ordering
and resorted to a dummy structure and a cast to allow a forward
reference to a structure. (Of course, by impossible I mean without
major rewrite of the offending header files.)
In short I needed a way to forward reference a structure offset.
George
More information about the Gcc-bugs
mailing list