Temporary Variables: Procrastination is the Thief of Time
C++ is a powerful programming language to learn, in part because it gives you full control over memory management. This is a two-edged sword, however; it lets you improve the performance of your code, but it also lets you shoot yourself in the foot. Therefore, it is important to understand the C++ compiler. This article examines how and why the compiler creates temporary objects, among other topics.
Temporary Variables: Procrastination is the Thief of Time - Temporary Object Terminology (Page 2 of 6 )
Lasting, used, serving, or enjoyed for a limited time.
Maybe you have run into the terms rvalue and/or lvalue while reading about C++. These are the terms used by the C++ Standard to discriminate between named objects (lvalues) and unnamed objects (rvalues).
According to the Wikipedia:
An lvalue is an expression that designates (refers to) an object. A non-modifiable lvalue is addressable, but not assignable. A modifiable lvalue allows the designated object to be changed as well as examined. An rvalue is any expression that isnít an lvalue, it refers to a data value that is stored at some address in memory.
What this basically means is that an lvalue (named object) is created every time you declare a variable explicitly (e.g. int i=1; or MyObject obj;). We are going to take a closer look at rvalues. These are the unseen temporary objects that are needed to implement parts of the C++ language (such as operator overloading). You never get to see them because they are fully handled by the compiler.