[Spice-devel] [PATCH 6/6] common: use INLINE instead of inline
cfergeau at redhat.com
Thu May 12 07:14:52 PDT 2011
On Thu, May 12, 2011 at 02:56:45PM +0300, Arnon Gilboa wrote:
> Christophe Fergeau wrote:
> >On Thu, May 12, 2011 at 12:37:31PM +0300, Arnon Gilboa wrote:
> >>needed for spice/common files used by the client, server & qxl driver.
> >>in windows _inline works for both c/c++, while inline is c++ only.
> >>compiling the client with mixed c/c++ code required this define.
> >I'd tend to change inline to INLINE in .h files, but to drop the "inline"
> >altogether when a static inline occurs in a .c file, the compiler should do
> >a better job than us at picking the functions that needs to be inlined.
> what's the diff between the two cases with regards to inlining?
In header files, if you don't have static inline, I think the compiler
sometimes complain about the same symbol being defined multiple times
(though I can't think of a way for that to happen, so maybe I'm wrong
here). Functions marked as "static" in a C file are local to that file, so
the compiler knows it can automatically inline the function and get rid of
it if it's worth it. Deciding whether to inline a function or not is
partially based on the generated code size, it's sometimes better to not
inline some functions if it leads to a smaller code size (so that the CPU
can more efficiently cache it).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: not available
More information about the Spice-devel