This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -fobey-inline (was Re: gcc and inlining)
Ross Smith <r-smith at ihug dot co dot nz> writes:
| On Tuesday, 18 March 2003 05:31, Joe Buck wrote:
| > On Sun, Mar 16, 2003 at 03:41:17PM -0300, Alexandre Oliva wrote:
| > > On Mar 15, 2003, Bernd Schmidt <bernds at redhat dot com> wrote:
| > > > And why not? If I add the "inline" keyword, I do it for a good
| > > > reason (I want the function inlined).
| > >
| > > What if you don't add the `inline' keyword, but define a member
| > > function inside the class body in C++? Per the C++ Standard, such
| > > a member function is implicitly `inline'. Must this inline marker
| > > get the same weight as a function defined outside the class body,
| > > with the inline keyword explicitly given?
| >
| > I would be willing to accept as a compromise that such implicit
| > inline requests are somehow "weaker" than explicit use of the inline
| > keyword. But it's frustrating to have to write nonstandard C++
| > (sorry, use of GNU directives is nonstandard) to get the compiler to
| > behave as requested when the word "inline" is explicitly typed.
|
| 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.
I strongly disagree with the above statements.
Non-exported template definitions need -not- be marked inline. And in
effect, the GNU standard library implementation gas lots of template
code with no explicit inline specifier.
-- Gaby