This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: inline funtcion of base class
- From: Hatt Tom <net dot study dot sea at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>, gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 21 Aug 2013 09:29:37 +0800
- Subject: Re: inline funtcion of base class
- References: <CAHvbk5Mj2VXB5Sa=9+wBNYiFKSL+7wxU=_H4YpE+Ydkk0bAU9g at mail dot gmail dot com> <CAH6eHdR68pCMOQ0FTR6zZY-AAph9cLoa-ifak4_V4d15bF3GmA at mail dot gmail dot com> <CAHvbk5N8U-e_-3jf7n1xiorFymJh6exwUoQdqq=W8J_3CE_xyg at mail dot gmail dot com> <CAH6eHdRK+hUxdZ9gv_1cHPq=9PfzX++oast75f-4AW6LDf_2Hg at mail dot gmail dot com>
OK! I will try it !
Thanks!
2013/8/20 Jonathan Wakely <jwakely.gcc@gmail.com>:
> On 20 August 2013 09:53, Hatt Tom wrote:
>> Thanks for reply !
>>
>>
>> I look into the disassembly instructions ,it show me that the call
>> procedure of B::func() own its stack frame ,and its first
>> instruction is push %ebp .
>>
>> so It is not dealed as a inline .
>
> The compiler is not required to inline functions even if they're
> declared as inline. If you don't enable optimisations when compiling
> there will be no function inlining. Even with optimisations the
> compiler might decide inlining the function would make it slower.
>
> If you want to force the optimisers to inline it you can use the GNU
> attribute always_inline.
--
Best Regards!