[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6734: "inline" overused in .c files?
From: |
Pádraig Brady |
Subject: |
bug#6734: "inline" overused in .c files? |
Date: |
Mon, 26 Jul 2010 23:47:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 |
On 26/07/10 19:53, 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.
>
> I've checked this only for coreutils/src/sort.c but perhaps the same
> argument applies to other source files in coreutils or other GNU apps, so
> I'll CC: this to bug-gnulib for more-general comment.
I never use inline in my own user space apps.
I do sometimes in lower level code when I want detailed control of the stack.
So please remove them.
cheers,
Pádraig.