This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -fobey-inline (was Re: gcc and inlining)


Ross Smith <r-smith at ihug dot co dot nz> writes:

| On Tuesday, 18 March 2003 07:22, you wrote:
| > On Tue, Mar 18, 2003 at 07:18:30AM +1200, Ross Smith wrote:
| > > The vast majority of inline functions in modern C++ are templates.
| > > Templates _have_ to be inline, either defined inside a class
| > > definition or explicitly marked inline if they're defined out of
| > > line or aren't class members. There's no portable way to use
| > > templates without marking them inline.
| >
| > This is not correct.  The template has to appear in the header; it
| > need not be declared inline.
| 
| Yes it does.

No, it does not.  Check out the C++ definition.

| A function defined in a header but not inline will trigger 
| ODR violations as soon as more than one module includes it.

Templates have special status.  See the chapter on implicit instantiations.
Have a look at the "Template instantiation" in the GCC manual.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]