std::pow implementation

Scott Robert Ladd coyote@coyotegulch.com
Thu Jul 31 18:45:00 GMT 2003


Steven Bosscher wrote:
>>2) The compiler should respect "inline" directives from the programmer, 
>>generating inline code when it is specified, unless doing so is 
>>technically impossible or blatantly inefficient.
> 
> I thought that the whole point in this discussion is that some people
> argue that the compiler cannot know when inlining an `inline' declared
> function is blatantly inefficient.

A decent compiler should be able to recognize patterns (e.g., big 
functions that can't be reduced) that render inlining inefficient.  And 
rejecting silly (i.e., undefined) requests, such as inlining "main", is 
to be expected.

In an ideal universe, explicit "inline" shouldn't be required (or even 
desirable.) Alas, current compiler technology is far from that ideal, 
and so responsibility for intelligent choices should fall to the 
programmer, not the compiler.

-- 
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing



More information about the Gcc mailing list