Re: Port from Win to OSX with Inline functions
Re: Port from Win to OSX with Inline functions
- Subject: Re: Port from Win to OSX with Inline functions
- From: "David Leimbach" <email@hidden>
- Date: Fri, 6 Oct 2006 16:46:02 -0700
Inline is a C99 keyword and still only a "hint" to the compiler.
To my knowledge, putting "inline" in a header file doesn't make it's
symbols static. And inline functions aren't allowed to also be static.
You're probably better off grouping the inline functions into a .c
file and then #include'ng it wherever it's needed as well as making
the functions static. (though I believe both inline and static is
illegal in C99).
It also sounds like the compiler is ignoring the hint to inline the functions.
And the excuse that it's inlined for performance is pretty bad unless
it's a measured speed improvement it. Function call overhead is
nowhere near as bad as it was in the 80s. What you should be
concerned about is TLB misses and cache warmth etc.
Different architectures really do perform differently too. It seems
that G5s like linear data accesses as the cache lines are large and
misses are costly.
Not sure if any of that advice helps... but it's some noise on a mailing list.
Dave
On 10/6/06, Chris Edgington <email@hidden> wrote:
I'm porting a large application from Windows to OSX. I'm trying to
minimize changes to my clients codebase. One area that is giving me
problems is inline functions. All over the place the client has
functions in header files marked as inline (this is a performance-
critical app). These header files get included by multiple .C files.
When building with gcc on OSX - what ends up happening is that the
compiler puts a copy of each inlined function in each .o file, then
when I goto link I get linker errors because of multiple definitions
of the same symbol.
Anybody have any thoughts on how to resolve this?
Thanks,
-Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden