首页 | 主题 | 图库 | 问答 | 文摘 | 原创 | 百科

历史 | 地理 | 人物 | 艺术 | 体育 | 科学 | 音乐 | 电影 | 信息技术 | 世界遗产

 开放、中立,源自维基百科

Personal tools

Null (computer programming)

From Wikipedia, the free encyclopedia

Jump to: navigation, search

Null has several meanings in computer programming.

Null pointer or null reference
  • Null is a special pointer value (or other kind of object reference) used to signify that a pointer intentionally does not point to (or refer to) an object. Such a pointer is called a null pointer.[1] Many implementations use a value of 0 (all bits zero) to represent the null pointer, as this is at the bottom of the address space of most CPUs (although some architectures use a signed address space and use the most negative value). Many operating systems generate an exception when an attempt is made to access this memory address. Some languages use other nomenclature for such a pointer, e.g., Pascal uses nil[2], while Visual Basic uses Nothing. Fortran does not consider it a constant, but a property that can be set by the NULLIFY directive and tested by the ASSOCIATED function.
    Null value
    • In many disciplines, the concept of null allows a three-valued logic, with null indicating "no value" or an "unknown value". The SQL database query language uses Null in this way, as do Visual Basic and its derivatives. In this model, an expression that depends on the value of a Null operand will evaluate to Null (VB) or "unknown" (SQL). So, for any A, the expressions "A = Null" and "A <> Null" are neither true nor false. However, the boolean operation "A and False" produces false, and similarly "A or True" is true, even when A is Null, because these expressions do not depend on the value of A. (Some SQL implementations may consider A = Null to be "true" if A is Null; see Null (SQL)).
    Null string
AD Links