[PATCH] Inlining realloc_struct
Hi, I guess functions in header files should be in inline? -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
On Fri, Mar 02, 2007 at 10:09:15AM +0800, Zuxy Meng wrote:
Hi,
I guess functions in header files should be in inline?
No particular reason it should or shouldn't be inline. In fact the inline keyword is supposed to be something of a no-op - the compiler should pick to inline or not based on which is better. I have no major objection to this patch but it's not really needed either. Not inlining might save a small amount of space and should not affect performance. Rich
Hi, 2007/3/2, Rich Felker <dalias@aerifal.cx>:
On Fri, Mar 02, 2007 at 10:09:15AM +0800, Zuxy Meng wrote:
Hi,
I guess functions in header files should be in inline?
No particular reason it should or shouldn't be inline. In fact the inline keyword is supposed to be something of a no-op - the compiler should pick to inline or not based on which is better. I have no major objection to this patch but it's not really needed either.
One benefit is that it avoids a "unused after use" warning:-)
Not inlining might save a small amount of space and should not affect performance. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2007/3/2, Rich Felker <dalias@aerifal.cx>:
On Fri, Mar 02, 2007 at 10:09:15AM +0800, Zuxy Meng wrote:
Hi,
I guess functions in header files should be in inline?
No particular reason it should or shouldn't be inline. In fact the inline keyword is supposed to be something of a no-op - the compiler should pick to inline or not based on which is better. I have no major objection to this patch but it's not really needed either. Not inlining might save a small amount of space and should not affect performance.
If a static function is defined in a header file that will be included multiple times, will ld collapse them together in the final executable? -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2007/3/2, Zuxy Meng <zuxy.meng@gmail.com>:
Hi,
I guess functions in header files should be in inline?
If nobody disagrees I plan to apply the attached patch this weekend. All functions defined in demuxer.h is both static and inline, as this is a header that is to be included multiple times. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2007/5/30, Zuxy Meng <zuxy.meng@gmail.com>:
Hi,
2007/3/2, Zuxy Meng <zuxy.meng@gmail.com>:
Hi,
I guess functions in header files should be in inline?
If nobody disagrees I plan to apply the attached patch this weekend. All functions defined in demuxer.h is both static and inline, as this is a header that is to be included multiple times.
Applied. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
Hi, 2007/6/3, Uoti Urpala <uoti.urpala@pp1.inet.fi>:
On Sun, 2007-06-03 at 00:06 +0800, Zuxy Meng wrote:
All functions defined in demuxer.h is both static and inline, as this is a header that is to be included multiple times.
Static functions defined in separate files do not affect each other whether inline or not.
Sure. But making it inline doesn't hurt either since it's in a header file, and has the additional benefit of avoiding 'unused after defined' warning. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
On Sun, 2007-06-03 at 00:32 +0800, Zuxy Meng wrote:
2007/6/3, Uoti Urpala <uoti.urpala@pp1.inet.fi>:
Static functions defined in separate files do not affect each other whether inline or not.
Sure. But making it inline doesn't hurt either since it's in a header file, and has the additional benefit of avoiding 'unused after defined' warning.
How is "since it's in a header file" relevant? It can increase code size just like it would with functions not in a header file (though of course this case doesn't have that big an effect, and not having a separate static function per every file which uses it would further reduce code size).
Hi, 2007/6/3, Uoti Urpala <uoti.urpala@pp1.inet.fi>:
On Sun, 2007-06-03 at 00:32 +0800, Zuxy Meng wrote:
2007/6/3, Uoti Urpala <uoti.urpala@pp1.inet.fi>:
Static functions defined in separate files do not affect each other whether inline or not.
Sure. But making it inline doesn't hurt either since it's in a header file, and has the additional benefit of avoiding 'unused after defined' warning.
How is "since it's in a header file" relevant? It can increase code size just like it would with functions not in a header file (though of course this case doesn't have that big an effect, and not having a separate static function per every file which uses it would further reduce code size).
The 'since' clause should have been applied to what was after 'and'. -- Zuxy Beauty is truth, While truth is beauty. PGP KeyID: E8555ED6
participants (3)
-
Rich Felker -
Uoti Urpala -
Zuxy Meng