This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: inline functions
- From: jlh <jlh at gmx dot ch>
- To: KÃvesdi GyÃrgy <kgy at deverto dot hu>, gcc-help at gcc dot gnu dot org
- Date: Fri, 13 Jul 2007 15:46:57 +0200
- Subject: Re: inline functions
- References: <200707131246.39324.kgy@deverto.hu>
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