- Value (computer science)
In
computer science , a value is a sequence ofbit s that is interpreted according to somedata type . It is possible for the same sequence of bits to have different values, depending on the type used to interpret its meaning. For instance, the value could be aninteger orfloating point value, or a string.Some kinds of value are common to most
programming language s (e.g., various kinds of number representations), while others are less commonly supported (e.g., Pascal supports a set type).Values are typically in high-level languages considered as referentially transparent, which means that storage details of expressions that produce values, such as the location in which the bits produced by the expression are stored, are not significant. Only the contents of the bits (whether they are 1 or 0) and their interpretation is significant. A value is the normal form of an expression, which means that an expression that is a value can not be
reduce d to a simpler expression. For example, the value of the expression "1 + 2" is "3", which cannot any longer be reduced to any simpler expression.In C: 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 a certain memory location. 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 to (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'.
The L-value expression designates (refers to) an object. A non-modifiable L-value is addressable, but not assignable. A modifiable L-value allows the designated object to be changed as well as examined. An R-value is any expression that is not an L-value, it refers to a data value that is stored at some address in memory.
The notion of L-values and R-values was introduced by CPL.
In assembly language
A value can be virtually any kind of data by a given data type, for instance a string, a digit, a single letter.
In assembly language there is something known as an "immediate value", sometimes referred to as "immediate" for short; An immediate value is stored in memory immediately next to (usually after) the instruction (mnemonic) which operates on it. (This is opposed to a non-immediate value which is stored elsewhere in memory.) Occasionally an immediate value is written as "imm#" where # is a number indicating the size of the immediate value, so imm8 would refer to an immediate 8-bit value. An immediate value is expressed as a number, either written with digits or as a string. "mnemonic 'A'" could be the same as "mnemonic 0x64"; the
byte order of strings differs depending on the assembler and computer architecture.External links
* [http://c2.com/cgi/wiki?ValueObject Value Object]
* [http://java.sun.com/blueprints/patterns/TransferObject.html Transfer Object Pattern]
Wikimedia Foundation. 2010.