曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 6811|回复: 0
打印 上一主题 下一主题

引用(Reference)与解引用(dereference)

[复制链接]

4917

主题

5879

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34382
跳转到指定楼层
楼主
发表于 2009-8-22 23:39:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
来自维基百科
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)。

一个引用和数据自身是截然不同的。典型的,一个引用可以是一个数据在内存中或者是在存储设备上的存储物理地址。基于此,一个引用通常被称为一个“指针”或者是一个“地址”,而它指向的是数据。然而,一个引用也可能指的是一个数据地址与一些经“修正”过的基地址的偏移,或者是一个数组的索引。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-5-13 20:08 , Processed in 0.077916 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表