[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Paolo Bonzini
Subject: bug#6734: "inline" overused in .c files?
Date: Mon, 26 Jul 2010 21:00:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]