[Freeciv-Dev] inlining functions
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
I looked over previous discussions about inlining functions, and I think
inlining functions is better.
An inlined function should be as fast as a macro. Although this may not
be the case for all compilers, we should let the compiler people worry
about it.
For any platforms (compilers) which don't support inline, we use
#defines to ignore inline so that things will compile cleanly. It looks
like configure already takes care of this.
Inline is in the ANSI C '99 standard, and should be supported by
most/all compilers. No example is given of a compiler that doesn't
support inline.
Tony Stuckey points out that "GCC doesn't do cross-procedural
optimization, nor cross-source-file inlining of small functions", and so
macros are better [1]. Again, I think this is a compiler issue.
In summary, after it was pointed out that inlining *might* not provide
as much speed benefit as using a macro, it looks like the discussion was
pretty much dropped. No profiling is done comparing the two AFAICT.
Doing some external research, it looks like a C++ compiler may balk at
the same inline definition configure generates for C code [3]. All
other "complaints" I found about unsupported inline were from years ago.
Finally, I read about a GCC option, "-finline-functions", that will
cause small functions to be inlined automatically.
[1] http://arch.freeciv.org/freeciv-dev-200101/msg00077.html
[2] http://arch.freeciv.org/freeciv-dev-200101/msg00087.html
[3] http://csf.colorado.edu/archive/1998/mozilla-unix/msg00164.html
jason
- [Freeciv-Dev] inlining functions,
Jason Dorje Short <=
- [Freeciv-Dev] Re: inlining functions, Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: inlining functions, Raimar Falke, 2001/08/19
- [Freeciv-Dev] Re: inlining functions, Kevin Brown, 2001/08/19
- [Freeciv-Dev] Re: inlining functions, Raimar Falke, 2001/08/20
- [Freeciv-Dev] Re: inlining functions, Markus Linnala, 2001/08/20
- [Freeciv-Dev] Re: inlining functions, Raimar Falke, 2001/08/20
- [Freeciv-Dev] Re: inlining functions, Markus Linnala, 2001/08/20
- [Freeciv-Dev] Re: inlining functions, Raimar Falke, 2001/08/20
[Freeciv-Dev] Re: inlining functions, Raimar Falke, 2001/08/20
|
|