|
来自维基百科In computer science, a reference is a value that enables a program to directly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing that data is called dereferencing the reference.
A refercence is distinct from the data itself. Typically, a reference is the physical address of where the data is stored in memory or in the storage device. For this reason, a reference is often called a pointer or address, and is said to point to the data. However a reference may also be the offset (diffrence) between the datum's address and some fixed "base" address, or an index into an array. 在计算机科学里,一个 引用 (reference) 是一个值,它使程序可以直接访问一个特定的数据项(比如一个变量或者一个记录) -- 这个数据项可以是在计算机内存中或者是在另外一些存储设备里。
“引用” 被称为数据项的一个“指向”。则访问这个数据,就被称为“解引用”(dereferencing)。
一个引用和数据自身是截然不同的。典型的,一个引用可以是一个数据在内存中或者是在存储设备上的存储物理地址。基于此,一个引用通常被称为一个“指针”或者是一个“地址”,而它指向的是数据。然而,一个引用也可能指的是一个数据地址与一些经“修正”过的基地址的偏移,或者是一个数组的索引。 |
|