inline functions
Augusto Mecking Caringi
augustocaringi at gmail.com
Sat Jun 4 11:38:15 EDT 2016
On Sat, Jun 4, 2016 at 11:59 AM, Muni Sekhar <munisekharrms at gmail.com> wrote:
> Hi,
>
> I tested with the below mentioned code("inline.c") to understand about
> inline functions.
>
> I explicitly instructed gcc to translate inline.c to inline.s.
>
> Next I removed the inline keyword from inline.c and re-created the
> inline.s file, but I don’t see any difference in the assembly code. Is
> it correct behavior?
>
> Could you guys point few good examples to understand the concept of inline?
Hi Muni,
Probably gcc is automatic inlining your function even in the
absence of 'inline' keyword...
Take a look here:
http://www.cocoabuilder.com/archive/xcode/269025-how-to-disable-gcc-automatic-inlining.html
And here:
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
There are a few inline related flags, including this:
-finline-functions-called-once
Consider all static functions called once for inlining into their
caller even if they are not marked inline. If a call to a given
function is integrated, then the function is not output as assembler
code in its own right.
Enabled at levels -O1, -O2, -O3 and -Os.
Best regards,
--
Augusto Mecking Caringi
More information about the Kernelnewbies
mailing list