Pop-Up Thingie
Sidebar
>>> Magnum BBS <<<
Home
Forum
Files
Dark
Log in
Username
Password
Sidebar
Forum
Usenet
COMP.LANG.C++
RVO vs. TCO
From
Marcel Mueller
@21:1/5 to
All
on Mon Jun 9 17:16:12 2025
Hello,
does a tail call prevent return value optimization?
vector<XXX> func1();
vector<XXX> func2()
{
if (some_condition)
return func1();
vector<XXX> result;
// populate result
return result;
}
AFAIK RVO requires all paths of a function to return the same instance.
But can this also work with tail calls like func1()?
If not, the following work around could be preferred:
vector<XXX> func3()
{
vector<XXX> result;
if (some_condition)
result = func1(); // forces move
else
; // populate result
return result;
}
Marcel
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
Who's Online
Recent Visitors
Amstrad Ppc
Sat Oct 31 19:07:41 2026
from
Wiltshire
via
Telnet
Amstrad Ppc
Sat Oct 31 17:11:55 2026
from
Wiltshire
via
Telnet
Ashenfieldx
Sat Oct 31 16:47:35 2026
from
Guelph, Ontario
via
Telnet
Amstrad Ppc
Sat Oct 31 16:34:27 2026
from
Wiltshire
via
Telnet
Amstrad Ppc
Sat Oct 31 15:21:38 2026
from
Wiltshire
via
Telnet
Amstrad Ppc
Sat Oct 31 15:13:22 2026
from
Wiltshire
via
SSH
Amstrad Ppc
Sat Oct 31 13:42:25 2026
from
Wiltshire
via
SSH
Root Cellar
Sat Oct 31 12:26:17 2026
from
505
via
Telnet
System Info
Sysop:
Keyop
Location:
Huddersfield, West Yorkshire, UK
Users:
796
Nodes:
16 (
3
/
13
)
Uptime:
150:59:53
Calls:
13,191
Calls today:
14
Files:
15,483
Messages:
6,579,291
Posted today:
2