This is the mail archive of the gcc-help@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: inline functions


KÃvesdi GyÃrgy wrote:
> I found that the function other_class::f2() cannot be inlined

I filled the blanks in your example with simple code and f1 as
well as f2 were inlined into the called of f2 when using -O1.  You
should provide a complete compilable example of a situation that
doesn't do what you want.

> Trying to add __attribute__((inline)) the result is a warning
> message about ignoring this attribute.

I guess it's because if you define a method directly in the class
body, you implicitely tell the compiler to inline it, thus making
this attribute redundant.  See [1].  (It still only happens with
optimization turned on.)

[1] http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.8


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