[vlc-devel] commit: Compiler knows better when to inline or not ( R??mi Denis-Courmont )

Laurent Aimar fenrir at via.ecp.fr
Tue Jun 30 10:51:33 CEST 2009

On Tue, Jun 30, 2009, jpd at videolan.org wrote:
> On Mon, Jun 29, 2009 at 05:38:44PM +0200, git version control wrote:
> > vlc | branch: master | R??mi Denis-Courmont <remi at remlab.net> | Mon Jun 29 18:23:53 2009 +0300| [05db60da2ec9dc4369817b6a67426f53483d79b5] | committer: R??mi Denis-Courmont 
> > 
> > Compiler knows better when to inline or not
> AFAIK it won't inline without an inline keyword in C (please correct me if
> I'm wrong)

gcc man page:
   Integrate all simple functions into their callers.  The compiler heuristically decides which functions are simple enough to be worth inte¿
   grating in this way.

   If all calls to a given function are integrated, and the function is declared "static", then the function is normally not output as assembler
   code in its own right.

   Enabled at level -O3.

So yes, it will inline even without the inline keyword. Btw, even with inline
keyword, the compilator may not inline a function (you have to use
__attribute__((always_inline)) inline but still not always working).

> but again AFAIK it won't anyway because these functions contain
> static tables. So this is a nitpick on the comment, really.
 With static const tables I am pretty sure it does.


More information about the vlc-devel mailing list