FACTOID # 166: Most households in Europe and North America contain fewer than three people.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Rvalue

In computer science, a value may be a number, literal string, array and anything that can be treated as if it were a number. In other words, label, subprogram, datatype, inheritance and control flow are not values in general. The exact definition varies across programming languages. Variables and subprogram calling sites are mostly treated as values.


The distinction from object is subtle but one can say that objects include references while values do not. References, however, are commonly expressed as values too, notably a pointer in C programming language. You may conclude that In C, therefore there is no difference between objects and values.


The use of a term value is useful in clarifying the exact meaning of assignments, copying, and comparison of objects. In the value model, for instance, objects itself are copied instead of references to it, they are treated as if they were numbers.


L-value and r-value

Some languages use the idea of l-value and r-value. L-values are values that have addresses, meaning they are variables or dereferenced references to certain place. R-value is either l-value or non-l-value — a term only used to distinguish from l-value. In C, the term l-value originally meant something that could be assigned (coming from left-value, indicating it was on the left side of the = operator), but since 'const' was added to the language, this now is termed a 'modifiable l-value'.


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.


See also

  • Attribute-Type-Value Object Language

External links

  • Value Object (http://c2.com/cgi/wiki?ValueObject)
  • Transfer Object Pattern (http://java.sun.com/blueprints/patterns/TransferObject.html)

  Results from FactBites:
 
move proposal (6349 words)
Treating "a" as an rvalue within f would lead to error prone code: First the "move version" of g() would be called, which would likely pilfer "a", and then the pilfered "a" would be sent to the move overload of h().
Introduction of the "rvalue reference" allows for the exception relating to temporaries and the implicit object parameter to be removed from the language (section 13.3.3.1.4 / 3).
The rvalue reference must be overloadable with the lvalue reference (the current reference).
The Forwarding Problem: Arguments (2372 words)
Another downside is that rvalues are forwarded as lvalues (a common trait of all presented solutions except #7).
Many still consider forwarding an rvalue where it otherwise would be rejected unacceptable (C2), but this is still better than the options we have under the current language semantics.
A perfect forwarding function would forward rvalue arguments as rvalues; none of the methods described so far achieve this, since it is not possible to determine from within a function whether an argument was an l- or an rvalue.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.