Value (computer science)

Value (computer science)

In computer science, a value is a sequence of bits that is interpreted according to some data 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 an integer or floating point value, or a string.

Some kinds of value are common to most programming languages (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 reduced 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.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Terminal value (computer science) — For other meanings of the term terminal value, see the Terminal value disambiguation page. In computer science, a terminal value is a string or character representing the end. eg, a terminal value is introduced when one hits the enter key in… …   Wikipedia

  • computer science — computer scientist. the science that deals with the theory and methods of processing information in digital computers, the design of computer hardware and software, and the applications of computers. [1970 75] * * * Study of computers, their… …   Universalium

  • Portal:Computer science — Wikipedia portals: Culture Geography Health History Mathematics Natural sciences People Philosophy Religion Society Technology …   Wikipedia

  • String (computer science) — In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet. In computer programming, a string is traditionally a sequence of… …   Wikipedia

  • Abstraction (computer science) — In computer science, abstraction is the process by which data and programs are defined with a representation similar to its pictorial meaning as rooted in the more complex realm of human life and language with their higher need of summarization… …   Wikipedia

  • Kernel (computer science) — In computer science, the kernel is the central component of most computer operating systems (OS). Its responsibilities include managing the system s resources (the communication between hardware and software components). As a basic component of… …   Wikipedia

  • Reference (computer science) — This article is about a general notion of reference in computing. For the more specific notion of reference used in C++, see Reference (C++). In computer science, a reference is a value that enables a program to indirectly access a particular… …   Wikipedia

  • Assignment (computer science) — In computer programming, an assignment statement sets or re sets the value stored in the storage location(s) denoted by a variable name. In most imperative computer programming languages, assignment statements are one of the basic statements.… …   Wikipedia

  • Integer (computer science) — In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values …   Wikipedia

  • Object (computer science) — In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure. (With the later introduction of object oriented programming the same word,… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”