return-value policy question

Nathan Myers ncm-nospam@cantrip.org
Tue Apr 29 18:40:00 GMT 2003


On Tue, Apr 29, 2003 at 08:58:51AM -0700, Mark Mitchell wrote:
> Programming style is obviously a highly contentious subject.

The question was not about style.  I'm entirely uninterested in
style preferences, at the moment.

The question was about code generation consequences, across the 
breadth of targets that Gcc generates code for.  Are there targets 
where the choice of writing single- or multiple- return paths makes 
a difference in code generated, and performance?  Or does the compiler 
always crush out all such source differences, and then generate one 
or many return paths according to the architecture's characteristics?  

When expanding inlines, does assigning to a non-const local variable 
affect the optimizer's ability to treat the value as a true rvalue 
temporary?  For certain functions (most particularly streambuf's
sputc, sgetc, and sbumpc) any small differences have very large 
effects.  I can measure my box, but that doesn't answer the general
question.

Nathan Myers
ncm-nospam@cantrip.org



More information about the Libstdc++ mailing list