Optimization, inline functions

me22 me22.ca@gmail.com
Fri Jul 4 06:15:00 GMT 2008


On Fri, Jul 4, 2008 at 01:34, Lee, Newbie <utmw0@hanmail.net> wrote:
> 0. Does 'gcc -O2' make functions inline?
>

Well, from your tests it sounds like it does.  It's probably
restricted to those cases where it's clearly beneficial, however.

> 1. Is function inlining is dangerous?
>

Dangerous? No.  But it does make incremental compiles possibly take
longer, and aggressive inlining makes the binary bigger, which can
actually make things slower.

> 2. Is 'gcc -O3 ' safe? (I heard -O2 is recommended)
>

Depends on the code.  -O3 contains things such as strict aliasing
which is one part of the standard that much code doesn't follow.  I
get the impression that "unsafeness" from -O3 is much more often a
result of UB in the code than from bugs in gcc.

HTH,
~ Scott



More information about the Gcc-help mailing list