std::pow implementation
Martin Reinecke
martin@MPA-Garching.MPG.DE
Wed Jul 30 15:27:00 GMT 2003
Gabriel Dos Reis wrote:
> The standard does mandate that the definition of an inline function
> be available in every translation unit that uses it.
Thanks for the clarification. But I think there is still no way to expose
the definition of a not-explicitely-inline function to all
translation units where it is used.
The fundamental problem is that there are three classes of functions:
- functions that should always be inlined
- functions where the compiler should decide
- functions that should never be inlined
The first category must have its definition in a header file.
The second category should have its definition in a header file also,
to give the compiler a chance of inlining it. But C++ won't let us,
because all functions with their definition in a header automatically
belong to the first category.
Something seems fundamentally wrong here, and I think it is C++'s property
to automatically put the "inline" tag on all functions defined in a class
body, even if they don't have the "inline" keyword. But I see no chance
to get this changed.
Maybe the discussion is so intense because there is no real solution?
Martin
More information about the Gcc
mailing list