Re: C++ 'extern inline' magic possible?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Kevin P. Fleming" <kpfleming@xxxxxxxxxx> writes:

> I would like to come up with some construction like the 'extern
> inline' that GCC supports for C mode, so that a.h could contain the
> declaration *and* definition of 'bar', allowing code that includes a.h
> to have 'bar' be inlined if the compiler chooses to do so (and leave
> an external reference to 'bar' if necessary so that the version built
> from a.cpp will be used). So far my attempts have only resulted in
> various re-definition or re-declaration errors.

There is no equivalent to GNU C's "extern inline" in C++.  By the way,
"extern inline" is now actually known as __attribute__ ((gnu_inline)),
as C99 defines "extern inline" to mean something different.

In C++ you can simply define the function inline in a.h, and not define
it at all in a.cpp.  The right thing will happen.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux