473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Hot(rvalue) Referencing and move proposal

first:
I find the 'r/l-value reference' terminology rather confusing and I
find the following names for this new refrence type more suitable:

temporary reference:
Since it is generally intended to refere to temporary objects

Immidiate referenc:
Since literals are assumed as temporary in C++ and immidiate or quick
in assembly language.

hot reference:
Temporary objects remind me of supernovas they die immidiately after
birth.According to lifetime we know that temporary lives on a single
line of code,an auto lives inside the block in which it is
defined ,static lives as long as it is refered to(longer than
auto),dynamic objects do not have a predefined lifetime;they live at
least one line of code and at most upto the end of program.So we see
that temporary is so hyperactive,so short lasting,so HOT.Since all
other storage classes have a longer liftime than a temporary, they
could be treated as if they were temporary - as long as the temporary
is not assumed to be destroyed after use(just like the swap example in
the move proposal).

every first is followed by a next:
I have been digging inside the move proposal(http://www.open-std.org/
jtc1/sc22/wg21/docs/papers/2002/n1377.htm).Although it invokes a
killing desire inside me,letting a hot refrence argument to be
returned is really disturbing.This example was exstracted out of the
move proposal document:

string&&
operator+(string&& x, const string& y)
{
return x += y;
}
Neglecting the 'operator+=' ,Had we declared 'x' and return type of
'operator+' as cold const references in this piece of code (ie 'const
string& operator+(const string& x, const string& y)'),according to
existing standards 'x' should have been destroyed immidiately after
'operator+' returns; therefor the return value of 'operator+' would be
undefined .However destruction of 'x'could be Postponed in expense of
a minimal stack memory overhead . now take the following more complex
example:

class huge_type;

huge_type&& go(huge_type&& x,huge_type&& y){

...

if(...){

...

return x;
};

...

return y;
};

Here the the function 'go' must decide whether the destruction of 'x'
or 'y' is to be performed/postponed just before returninig (). The
stack overhead might be different for 'x' and 'y'- according to
evaluation order of objects . Since huge_type is big in size ,this
approach might be overmuch stack-consuming .A normal return with a
move construction would be a better solution specially if the
destructor and move constructor are trivial ones-in which case the
stack overhead could implicitly be removed in expense of a minimal mem-
copy(move) run-time overhead for the worst case.

Mar 9 '07 #1
0 1634

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jan Wieck | last post by:
Dear community, for some reason the post I sent yesterday night still did not show up on the mailing lists. I have set up some links on the developers side under...
3
by: Glen Hong | last post by:
I have set up a hotkey using RegisterHotKey API function for Ctrl-Tab. Firstly, I can rap this when Ctrl-Tab is pressed however if I want to add an addition hotkey how can I distinguish between...
11
by: BobAchgill | last post by:
The needed capability: I guess there are two possibilities for making "hot spots" on a Windows Form: The Scenario: I have a world map as the form background. I need clickable hotspots over...
1
by: Randy Harris | last post by:
I would like to suggest a change, not to the charter, or the FAQ, but to the name of CDMA. After our successful seasons featuring the lunatic and then the crook and goons, this season's offering,...
4
by: steve_barker333 | last post by:
Hi guys! I keep getting the following error reported by VS 2005 in my ASP.NET 2.0 web project: "The type or namespace name 'MainPages_XXX' could not be found (are you missing a using...
26
by: brenocon | last post by:
Hi all -- Compared to the Python I know and love, Ruby isn't quite the same. However, it has at least one terrific feature: "blocks". Whereas in Python a "block" is just several lines of...
19
by: klenwell | last post by:
Another request for comments here. I'd like to accomplish something like the scheme outlined at this page here: http://tinyurl.com/3dtcdr In a nutshell, the form uses javascript to hash...
1
by: rmcellig | last post by:
This is the code I am using at the moment for my pull down menu. It works great. I was wondering if it is possible to have the pull down menu reference a list file instead of entering each item...
2
by: Andrus | last post by:
I need compile in-memory assembly which references to other in-memory assembly. Compiling second assembly fails with error Line: 0 - Metadata file 'eed7li9m, Version=0.0.0.0, Culture=neutral,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.