Mail Archives: djgpp/2001/09/09/07:36:36
> From: "Raf256" <raf256 AT go2 DOT pl>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sun, 9 Sep 2001 11:29:37 +0200
>
> why use 'inline' statment ? If compiler is good enought, it sholud give same
> result if functions are and aren't inline, when optimization for speed is
> checked...
The compiler won't inline functions unless you use the "-O3" switch.
However, the current optimization technology is not smart enough to
find functions that can benefit from inlining. So the compiler
inlines all the function in sight, and that generally makes your
program slower. For that reason, you are well advised to compile with
"-O2" (which does not inline automatically), but declare inline only
those functions you know are will be called in the inner loops.
The above is true for C programs. Things are a bit different in C++,
where class methods are inlined even with "-O2", as if they were
declared inline.
- Raw text -