Subject: bug#6734: "inline" overused in .c files?

From: Paolo Bonzini <[email-masked]>
Date: Mon, 26 Jul 2010 21:00:51 +0200

On 07/26/2010 08:53 PM, Paul Eggert wrote:
> I noticed thirteen "inline"s in coreutils/src/sort.c.  Just for fun, I
> removed them all.  In ten cases, removing "inline" made no difference to
> the generated machine code on my platform (RHEL 5, x86-64, GCC 4.1.2,
> compiled with the typical gcc -O2).  In the three sort.c functions
> that were exceptions (queue_insert, write_unique, check_insert),
> removing "inline" made the overall code a tad shorter with no
> measurable change to CPU performance.
>
> Is there a reason those "inline"s are in there?  If not, I'm inclined
> to remove them.  I can see a use for "static inline" in .h files, as
> this asks the compiler not to warn about unused functions, but as far
> as I know, it's typically not necessary to use "inline" in .c files
> these days, as the compiler is typically smart enough.

Only at -O3, except for special cases like functions called once. 
However, in general I agree that inline is not beneficial except for 
bottlenecks that can be identified by profiling.

Paolo