NRVO

NRVO

Post by Chris.Thei » Sun, 17 Oct 2004 06:19:18


Hi all,

Ie been some looking around lately regarding NRVO. Up to now a number of
compilers (gcc 3.3, zortech, cfront, Intel 6., MSVC 7.1 etc.) do implement
this on the optimization level. However, I wonder whether there are any
plans to incorporate this into the requirements of the standard. Does anyone
know a little more if there are such plans and how far this has gone up to
now?

Cheers
Chris


---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.yqcomputer.com/ ]
 
 
 

NRVO

Post by rtw » Sun, 17 Oct 2004 12:26:35


comp.std.c++:


Example:

struct A { int a; };

A f()
{
A nrv;
return nrv;
}

Given that on many systems int's are typicaly returned in registers
a Named Return Value *Requirment* would actually be a slowdown for
the above code on many platform's as the option to return via a
rvalue/temporary (in a register) would be removed.

I may be wrong but I suspect this is the reason RVO/NRVO are
*Optimizations* in the first place.

Rob.
--
http://www.yqcomputer.com/

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.yqcomputer.com/ ]

 
 
 

NRVO

Post by Christian. » Mon, 18 Oct 2004 04:16:35


"Rob Williscroft" < XXXX@XXXXX.COM > schrieb im Newsbeitrag



I agree with you on that issue, but the interesting thing is that most
compilers perform NRVO "optimization" even without having optimization
explicitly turned on. But to what extent and whether situations like the one
you gave above are handled well, is beyond my knowledge without checking the
actual assembler code.

Cheers
Chris



---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.yqcomputer.com/ ]
 
 
 

NRVO

Post by rtw » Tue, 19 Oct 2004 05:43:50


comp.std.c++:


Yep, but the standard doesn't mention the term's RVO and NRVO, they are
just thing's somebody made up to describe what the standard allows, and
that they're optional.

Named Return Value Optional-behaviour maybe :).


I don't know either, the last time I took an interest in such things
it was with a pre-standard compiler, but at that time Borland C++
had some rules about which UDT's it would return in registers,
1 byte, 2 byte and 4 byte structs only IIRC.

Rob.
--
http://www.yqcomputer.com/

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.yqcomputer.com/ ]