Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 In C: lvalues and rvalues  





2 In assembly language  





3 External links  














Value (computer science)






Català
Čeština
Deutsch
Ελληνικά
Español
Esperanto
فارسی

Hrvatski
Ido
Bahasa Indonesia
Italiano
עברית

Polski
Português
Русский
Simple English
Suomi
Tagalog

Українська
Tiếng Vit

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




Print/export  



















Appearance
   

 






From Wikipedia, the free encyclopedia
 


This is an old revision of this page, as edited by 203.97.97.131 (talk)at23:09, 16 November 2009. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff)  Previous revision | Latest revision (diff) | Newer revision  (diff)

Incomputer 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 integerorfloating 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).

In declarative (high-level) laasbasbasbasbasbasbasbasbnguages, values have to be referentially transparent. This means that the resulting value is independent of the fact in which location a (sub-)expression needed to compute the value is stored. Only the contents of the location (the bits, whether they are 1 or 0) and their interpretation are 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 a simpler expression.

In C: lvalues and rvalues

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

The lvalue expression 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 is not an lvalue. One example is an "immediate value" (look below) and consequently not addressable. Another example is the C expression (4 + 9). When executed, the computer generates the an integer value of 13, but because the program has not explicitly designated where in the computer this 13 is stored, the expression is an rvalue. On the other hand, if a C program declares a variable x and assigns the value of 13 to x, then the expresfuck youvalue of 13 and is an lvalue.

The notion of lvalues and rvalues 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.

Most processors provide one or more instructions which take an "immediate value", sometimes referred to as "immediate" for short. An immediate value is stored as part of the instruction which employs it, usually to load into, add to, or subtract from, a register. The other parts of the instruction are the opcode, and destination. The latter may be implicit. (A non-immediate value may reside in a register, or be stored elsewhere in memory, requiring the instruction to contain a direct or indirect address [e.g. index register address] to the value.)

Some processors support more than one size of immediate data, e.g. 8 or 16 bit, employing a unique opcode and mnemonic for each instruction variant. If a programmer supplies a data value that will not fit, the assembler issues an "Out of range" error message. Most assemblers allow an immediate value to be expressed as ASCII, decimal, hexadecimal, octal, or binary data. Thus, the ASCII character "'A'" is the same as "65" or "0x41". The byte order of strings may differ between processors, depending on the assembler and computer architecture.

External links


Retrieved from "https://en.wikipedia.org/w/index.php?title=Value_(computer_science)&oldid=326244723"

Categories: 
Value
Computer data
Hidden categories: 
Articles lacking sources from August 2009
All articles lacking sources
 



This page was last edited on 16 November 2009, at 23:09 (UTC).

This version of the page has been revised. Besides normal editing, the reason for revision may have been that this version contains factual inaccuracies, vandalism, or material not compatible with the Creative Commons Attribution-ShareAlike License.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki