Null pointer: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>Mcsee
m code smell
 
 
Line 9: Line 9:
== C ==
== C ==


In [[C (programming language)|C]], two null pointers of any type are guaranteed to compare equal.<ref>[[#c-std|ISO/IEC 9899]], clause 6.3.2.3, paragraph 4.</ref> Prior to C23, the preprocessor macro <code>NULL</code> was provided, defined as an implementation-defined null pointer constant in <code><[[stdlib.h]]></code>,<ref>[[#c-std|ISO/IEC 9899]], clause 7.17, paragraph 3: ''NULL... which expands to an implementation-defined null pointer constant...''</ref> which in [[C99]] can be portably expressed as <code>((void *)0)</code>, the integer value <code>0</code> [[Type conversion|converted]] to the type <code>void*</code> (see [[pointer to void type]]).<ref>[[#c-std|ISO/IEC 9899]], clause 6.3.2.3, paragraph 3.</ref> Since [[C23 (C standard revision)|C23]], a null pointer is represented with <code>nullptr</code> which is of type <code>nullptr_t</code> (originally introduced to C++11), providing a type safe null pointer.<ref name="N3042">{{cite web |title=WR14-N3042: Introduce the nullptr constant |url=https://open-std.org/JTC1/SC22/WG14/www/docs/n3042.htm |website=open-std.org |archive-url=https://web.archive.org/web/20221224043228/https://open-std.org/JTC1/SC22/WG14/www/docs/n3042.htm |archive-date=December 24, 2022 |date=2022-07-22 |url-status=live}}</ref>
In [[C (programming language)|C]], two null pointers of any type are guaranteed to compare equal.<ref>[[#c-std|ISO/IEC 9899]], clause 6.3.2.3, paragraph 4.</ref> Prior to C23, the preprocessor macro <code>NULL</code> was provided, defined as an implementation-defined null pointer constant in <code><[[stdlib.h]]></code>,<ref>[[#c-std|ISO/IEC 9899]], clause 7.17, paragraph 3: ''NULL... which expands to an implementation-defined null pointer constant...''</ref> which in [[C99]] can be portably expressed with {{code|#define NULL ((void*)0)|c}}, the integer value <code>0</code> [[Type conversion|converted]] to the type <code>void*</code> (see [[pointer to void type]]).<ref>[[#c-std|ISO/IEC 9899]], clause 6.3.2.3, paragraph 3.</ref> Since [[C23 (C standard revision)|C23]], a null pointer is represented with <code>nullptr</code> which is of type <code>nullptr_t</code> (first introduced to C++11), providing a type safe null pointer.<ref name="N3042">{{cite web |title=WR14-N3042: Introduce the nullptr constant |url=https://open-std.org/JTC1/SC22/WG14/www/docs/n3042.htm |website=open-std.org |archive-url=https://web.archive.org/web/20221224043228/https://open-std.org/JTC1/SC22/WG14/www/docs/n3042.htm |archive-date=December 24, 2022 |date=2022-07-22 |url-status=live}}</ref>


The C standard does not say that the null pointer is the same as the pointer to [[memory address]]&nbsp;0, though that may be the case in practice. [[Dereferencing]] a null pointer is [[undefined behavior]] in C,<ref name="ub"/> and a conforming implementation is allowed to assume that any pointer that is dereferenced is not null.
The C standard does not say that the null pointer is the same as the pointer to [[memory address]]&nbsp;0, though that may be the case in practice. [[Dereferencing]] a null pointer is [[undefined behavior]] in C,<ref name="ub"/> and a conforming implementation is allowed to assume that any pointer that is dereferenced is not null.
Line 20: Line 20:


== Other languages ==
== Other languages ==
In some programming language environments (at least one proprietary Lisp implementation, for example),{{citation needed|date=September 2011}} the value used as the null pointer (called <code>nil</code> in [[Lisp (programming language)|Lisp]]) may actually be a pointer to a block of internal data useful to the implementation (but not explicitly reachable from user programs), thus allowing the same register to be used as a useful constant and a quick way of accessing implementation internals.  This is known as the <code>nil</code> vector.


In languages with a [[tagged architecture]], a possibly null pointer can be replaced with a [[tagged union]] which enforces explicit handling of the exceptional case; in fact, a possibly null pointer can be seen as a [[tagged pointer]] with a computed tag.
In languages with a [[tagged architecture]], a possibly null pointer can be replaced with a [[tagged union]] which enforces explicit handling of the exceptional case; in fact, a possibly null pointer can be seen as a [[tagged pointer]] with a computed tag.


Programming languages use different literals for the ''null pointer''. In [[Python (programming language)|Python]], for example, a null value is called <code>None</code>. In [[Java (programming language)|Java]] and [[C Sharp (programming language)|C#]], the literal <code>null</code> is provided as a literal for reference types. In [[Pascal (programming language)|Pascal]] and [[Swift (programming language)|Swift]], a null pointer is called <code>nil</code>. In [[Eiffel (programming language)|Eiffel]], it is called a <code>void</code> reference.
Programming languages use different literals for the ''null pointer''. In [[Java (programming language)|Java]] and [[C Sharp (programming language)|C#]], the literal <code>null</code> is provided as a literal for reference types. In [[Pascal (programming language)|Pascal]] and [[Swift (programming language)|Swift]], a null pointer is called <code>nil</code>. In [[Eiffel (programming language)|Eiffel]], it is called a <code>void</code> reference. In [[Rust (programming language)|Rust]], the absence of a value is denoted as <code>None</code>, but a true null pointer is <code>std::ptr::null()</code>.


== Null dereferencing ==
== Null dereferencing ==
Line 32: Line 30:


* In [[C (programming language)|C]], dereferencing a null pointer is [[undefined behavior]].<ref name="ub">[[#c-std|ISO/IEC 9899]], clause 6.5.3.2, paragraph 4, esp. footnote 87.</ref> Many implementations cause such code to result in the program being halted with an [[access violation]], because the null pointer representation is chosen to be an address that is never allocated by the system for storing objects. However, this behavior is not universal. It is also not guaranteed, since compilers are permitted to optimize programs under the assumption that they are free of undefined behavior. This behaviour is the same in [[C++]], as there is no null pointer exception in the C++ language. On platforms such as [[Unix-like]] systems and [[Windows]] with the [[Visual Studio]] compiler, an access violation causes a C/C++ <code>[[SIGSEGV]]</code> signal to be issued. Although in C/C++ null dereferences are not exceptions which can be caught in C++ <code>try</code>/<code>catch</code> blocks, it is possible to "catch" such an access violation by using (<code>std::</code>)<code>signal()</code> in C/C++ to specify a handler to be called when that signal is issued.
* In [[C (programming language)|C]], dereferencing a null pointer is [[undefined behavior]].<ref name="ub">[[#c-std|ISO/IEC 9899]], clause 6.5.3.2, paragraph 4, esp. footnote 87.</ref> Many implementations cause such code to result in the program being halted with an [[access violation]], because the null pointer representation is chosen to be an address that is never allocated by the system for storing objects. However, this behavior is not universal. It is also not guaranteed, since compilers are permitted to optimize programs under the assumption that they are free of undefined behavior. This behaviour is the same in [[C++]], as there is no null pointer exception in the C++ language. On platforms such as [[Unix-like]] systems and [[Windows]] with the [[Visual Studio]] compiler, an access violation causes a C/C++ <code>[[SIGSEGV]]</code> signal to be issued. Although in C/C++ null dereferences are not exceptions which can be caught in C++ <code>try</code>/<code>catch</code> blocks, it is possible to "catch" such an access violation by using (<code>std::</code>)<code>signal()</code> in C/C++ to specify a handler to be called when that signal is issued.
** Some external C++ libraries, such as [[POCO C++ Libraries]], include a <code>NullPointerException</code> class. Unlike Java, where <code>java.lang.NullPointerException</code> extends <code>java.lang.RuntimeException</code>, <code>Poco::NullPointerException</code> instead extends <code>Poco::LogicException</code>.<ref>{{cite web|title=Class Poco::NullPointerException|url=https://docs.pocoproject.org/current/Poco.NullPointerException.html|access-date=17 August 2025|publisher=docs.pocoproject.org}}</ref>
* In [[Cyclone (programming language)|Cyclone]], a failed null pointer check will throw a <code>Null_Exception</code>.
* In [[D (programming language)|D]], much like C++, a null pointer dereference results in a segmentation fault.
* In [[D (programming language)|D]], much like C++, a null pointer dereference results in a segmentation fault.
* In [[Delphi (programming language)|Delphi]] and many other Pascal implementations, the constant {{code|nil}} represents a null pointer to the first address in memory which is also used to initialize managed variables. Dereferencing it raises an external OS exception which is mapped onto a Pascal {{code|EAccessViolation}} exception instance if the {{code|System.SysUtils}} unit is linked in the {{code|uses}} clause.
* In [[Delphi (programming language)|Delphi]] and many other Pascal implementations, the constant {{code|nil}} represents a null pointer to the first address in memory which is also used to initialize managed variables. Dereferencing it raises an external OS exception which is mapped onto a Pascal {{code|EAccessViolation}} exception instance if the {{code|System.SysUtils}} unit is linked in the {{code|uses}} clause.
* In [[Java (programming language)|Java]], access to a null reference (<code>null</code>) causes a {{Javadoc:SE|java/lang|NullPointerException}} (NPE), which can be caught by error handling code, but the preferred practice is to ensure that such exceptions never occur.
* In [[Java (programming language)|Java]], access to a null reference (<code>null</code>) causes a {{Javadoc:SE|java/lang|NullPointerException}} (NPE), which can be caught by error handling code, but the preferred practice is to ensure that such exceptions never occur.
* In [[Lisp_(programming_language)|Lisp]], {{code|nil}} is a [[first class object]]. By convention, <code>(first nil)</code> is {{code|nil}}, as is <code>(rest nil)</code>. So dereferencing {{code|nil}} in these contexts will not cause an error, but poorly written code can get into an infinite loop.
* In [[.Net (programming language)|.NET]] and [[C Sharp (programming language)|C#]], access to null reference (<code>null</code>) causes a {{code|System.NullReferenceException}} to be thrown. Although catching these is generally considered bad practice, this exception type can be caught and handled by the program.
* In [[.Net (programming language)|.NET]] and [[C Sharp (programming language)|C#]], access to null reference (<code>null</code>) causes a {{code|NullReferenceException}} to be thrown. Although catching these is generally considered bad practice, this exception type can be caught and handled by the program.
* In [[Objective-C]], messages may be sent to a {{code|nil}} object (which is a null pointer) without causing the program to be interrupted; the message is simply ignored, and the return value (if any) is {{code|nil}} or {{code|0}}, depending on the type.<ref>{{cite web |title=The Objective-C 2.0 Programming Language |url=https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocObjectsClasses.html#//apple_ref/doc/uid/TP30001163-CH11-SW7 |at=section "Sending Messages to nil"}}</ref>
* In [[Objective-C]], messages may be sent to a {{code|nil}} object (which is a null pointer) without causing the program to be interrupted; the message is simply ignored, and the return value (if any) is {{code|nil}} or {{code|0}}, depending on the type.<ref>''The Objective-C 2.0 Programming Language'', [https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocObjectsClasses.html#//apple_ref/doc/uid/TP30001163-CH11-SW7 section "Sending Messages to nil"].</ref>
* In [[Python (programming language)|Python]], dereferencing <code>None</code> raises an <code>AttributeError</code>, as <code>NoneType</code> has no (user-facing) methods or attributes defined.
* In [[Rust (programming language)|Rust]], dereferencing a null pointer (<code>std::ptr::null()</code>) in an <code>unsafe</code> block results in undefined behaviour, which usually results in a segmentation fault or corrupted memory.
* In [[Rust (programming language)|Rust]], dereferencing a null pointer (<code>std::ptr::null()</code>) in an <code>unsafe</code> block results in undefined behaviour, which usually results in a segmentation fault or corrupted memory.
* Before the introduction of [[Supervisor Mode Access Prevention]] (SMAP), a null pointer dereference bug could be exploited by mapping [[Zero page|page zero]] into the attacker's [[address space]] and hence causing the null pointer to point to that region. This could lead to [[Arbitrary code execution|code execution]] in some cases.<ref>[https://project-zero.issues.chromium.org/issues/42452311 "OS X exploitable kernel NULL pointer dereference in AppleGraphicsDeviceControl"]</ref>
* Before the introduction of [[Supervisor Mode Access Prevention]] (SMAP), a null pointer dereference bug could be exploited by mapping [[Zero page|page zero]] into the attacker's [[address space]] and hence causing the null pointer to point to that region. This could lead to [[Arbitrary code execution|code execution]] in some cases.<ref>{{cite web |url=https://project-zero.issues.chromium.org/issues/42452311 |title=OS X exploitable kernel NULL pointer dereference in AppleGraphicsDeviceControl}}</ref>


== Mitigation ==
== Mitigation ==


While there could be languages with no nulls, most do have the possibility of nulls so there are techniques to avoid or aid debugging null pointer dereferences.<ref name="BondNethercote2007">{{cite book|last1=Bond|first1=Michael D.|last2=Nethercote|first2=Nicholas|last3=Kent|first3=Stephen W.|last4=Guyer|first4=Samuel Z.|last5=McKinley|first5=Kathryn S.|title=Proceedings of the 22nd annual ACM SIGPLAN conference on Object oriented programming systems and applications - OOPSLA '07|chapter=Tracking bad apples|year=2007|pages=405|doi=10.1145/1297027.1297057|isbn=9781595937865|s2cid=2832749}}</ref> Bond et al.<ref name="BondNethercote2007"/> suggest modifying the Java Virtual Machine (JVM) to keep track of null propagation.
While there could be languages with no nulls, most do have the possibility of nulls so there are techniques to avoid or aid debugging null pointer dereferences.<ref name="BondNethercote2007">{{cite book|last1=Bond|first1=Michael D.|last2=Nethercote|first2=Nicholas|last3=Kent|first3=Stephen W.|last4=Guyer|first4=Samuel Z.|last5=McKinley|first5=Kathryn S.|title=Proceedings of the 22nd annual ACM SIGPLAN conference on Object oriented programming systems and applications - OOPSLA '07|chapter=Tracking bad apples|year=2007|pages=405|doi=10.1145/1297027.1297057|isbn=9781595937865|s2cid=2832749}}</ref> Bond et al. suggest modifying the [[Java virtual machine]] (JVM) to keep track of null propagation.<ref name="BondNethercote2007"/>


There are three levels of handling null references, in order of effectiveness:
There are three levels of handling null references, in order of effectiveness:
Line 53: Line 51:
Pure [[functional languages]] are an example of level 1 since no direct access is provided to pointers and all code and data is immutable. User code running in [[interpreter (computing)|interpreted]] or virtual-machine languages generally does not suffer the problem of null pointer dereferencing.{{dubious|VM claim|date=September 2024}}
Pure [[functional languages]] are an example of level 1 since no direct access is provided to pointers and all code and data is immutable. User code running in [[interpreter (computing)|interpreted]] or virtual-machine languages generally does not suffer the problem of null pointer dereferencing.{{dubious|VM claim|date=September 2024}}


Where a language does provide or utilise pointers which could become void, it is possible to avoid runtime null dereferences by providing [[void safety|compilation-time checking]] via [[static analysis]] or other techniques, with syntactic assistance from language features such as those seen in the [[Eiffel programming language]] with Void safety<ref>{{cite web | url=https://www.eiffel.org/doc/eiffel/Void-safety-_Background%2C_definition%2C_and_tools |title=Void-safety: Background, definition, and tools|access-date=2021-11-24 }}</ref> to avoid null derefences, [[D programming language|D]],<ref name="SafeD">{{cite web |title=SafeD – D Programming Language |url=http://dlang.org/safed.html |author=Bartosz Milewski |access-date=17 July 2014}}</ref> and [[Rust programming language|Rust]].<ref>{{cite web|title=Fearless Security: Memory Safety|url=https://hacks.mozilla.org/2019/01/fearless-security-memory-safety/|access-date=4 November 2020|archive-date=8 November 2020|archive-url=https://web.archive.org/web/20201108003116/https://hacks.mozilla.org/2019/01/fearless-security-memory-safety/|url-status=live}}</ref>
Where a language does provide or utilise pointers which could become void, it is possible to avoid runtime null dereferences by providing [[void safety|compilation-time checking]] via [[static analysis]] or other techniques, with syntactic assistance from language features such as those seen in the [[Eiffel programming language]] with Void safety<ref>{{cite web | url=https://www.eiffel.org/doc/eiffel/Void-safety-_Background%2C_definition%2C_and_tools |title=Void-safety: Background, definition, and tools|access-date=2021-11-24 }}</ref> to avoid null dereferences, [[D programming language|D]],<ref name="SafeD">{{cite web |title=SafeD – D Programming Language |url=http://dlang.org/safed.html |author=Bartosz Milewski |access-date=17 July 2014}}</ref> and [[Rust programming language|Rust]].<ref>{{cite web|title=Fearless Security: Memory Safety|url=https://hacks.mozilla.org/2019/01/fearless-security-memory-safety/|access-date=4 November 2020|archive-date=8 November 2020|archive-url=https://web.archive.org/web/20201108003116/https://hacks.mozilla.org/2019/01/fearless-security-memory-safety/|url-status=live}}</ref>


In some languages analysis can be performed using external tools, but these are weak compared to direct language support with compiler checks since they are limited by the language definition itself.
In some languages analysis can be performed using external tools, but these are weak compared to direct language support with compiler checks since they are limited by the language definition itself.

Latest revision as of 07:50, 21 December 2025

Template:Short description

In computing, a null pointer (sometimes shortened to nullptr or null) or null reference is a value saved for indicating that the pointer or reference does not refer to a valid object. Programs routinely use null pointers to represent conditions such as the end of a list of unknown length or the failure to perform some action; this use of null pointers can be compared to nullable types and to the Nothing value in an option type.

A null pointer should not be confused with an uninitialized pointer: a null pointer is guaranteed to compare unequal to any pointer that points to a valid object. However, in general, most languages do not offer such guarantee for uninitialized pointers. It might compare equal to other, valid pointers; or it might compare equal to null pointers. It might do both at different times; or the comparison might be undefined behavior. Also, in languages offering such support, the correct use depends on the individual experience of each developer and linter tools. Even when used properly, null pointers are semantically incomplete, since they do not offer the possibility to express the difference between "not applicable", "not known", and "future" values.Script error: No such module "Unsubst".

Because a null pointer does not point to a meaningful object, an attempt to access the data stored at that (invalid) memory location may cause a run-time error or immediate program crash. This is the null pointer error, or null pointer exception. It is one of the most common types of software weaknesses,[1] and Tony Hoare, who introduced the concept, has referred to it as a "billion dollar mistake".[2]

C

In C, two null pointers of any type are guaranteed to compare equal.[3] Prior to C23, the preprocessor macro NULL was provided, defined as an implementation-defined null pointer constant in <stdlib.h>,[4] which in C99 can be portably expressed with #define NULL ((void*)0), the integer value 0 converted to the type void* (see pointer to void type).[5] Since C23, a null pointer is represented with nullptr which is of type nullptr_t (first introduced to C++11), providing a type safe null pointer.[6]

The C standard does not say that the null pointer is the same as the pointer to memory address 0, though that may be the case in practice. Dereferencing a null pointer is undefined behavior in C,[7] and a conforming implementation is allowed to assume that any pointer that is dereferenced is not null.

In practice, dereferencing a null pointer may result in an attempted read or write from memory that is not mapped, triggering a segmentation fault or memory access violation. This may manifest itself as a program crash, or be transformed into a software exception that can be caught by program code. There are, however, certain circumstances where this is not the case. For example, in x86 real mode, the address 0000:0000 is readable and also usually writable, and dereferencing a pointer to that address is a perfectly valid but typically unwanted action that may lead to undefined but non-crashing behavior in the application; if a null pointer is represented as a pointer to that address, dereferencing it will lead to that behavior. There are occasions when dereferencing a pointer to address zero is intentional and well-defined; for example, BIOS code written in C for 16-bit real-mode x86 devices may write the interrupt descriptor table (IDT) at physical address 0 of the machine by dereferencing a pointer with the same value as a null pointer for writing. It is also possible for the compiler to optimize away the null pointer dereference, avoiding a segmentation fault but causing other undesired behavior.[8]

C++

In C++, while the NULL macro was inherited from C, the integer literal for zero has been traditionally preferred to represent a null pointer constant.[9] However, C++11 introduced the explicit null pointer constant nullptr and type nullptr_t to be used instead, providing a type safe null pointer. nullptr and type nullptr_t were later introduced to C in C23.

Other languages

In languages with a tagged architecture, a possibly null pointer can be replaced with a tagged union which enforces explicit handling of the exceptional case; in fact, a possibly null pointer can be seen as a tagged pointer with a computed tag.

Programming languages use different literals for the null pointer. In Java and C#, the literal null is provided as a literal for reference types. In Pascal and Swift, a null pointer is called nil. In Eiffel, it is called a void reference. In Rust, the absence of a value is denoted as None, but a true null pointer is std::ptr::null().

Null dereferencing

Because a null pointer does not point to a meaningful object, an attempt to dereference (i.e., access the data stored at that memory location) a null pointer usually (but not always) causes a run-time error or immediate program crash. MITRE lists the null pointer error as one of the most commonly exploited software weaknesses.[10]

  • In C, dereferencing a null pointer is undefined behavior.[7] Many implementations cause such code to result in the program being halted with an access violation, because the null pointer representation is chosen to be an address that is never allocated by the system for storing objects. However, this behavior is not universal. It is also not guaranteed, since compilers are permitted to optimize programs under the assumption that they are free of undefined behavior. This behaviour is the same in C++, as there is no null pointer exception in the C++ language. On platforms such as Unix-like systems and Windows with the Visual Studio compiler, an access violation causes a C/C++ SIGSEGV signal to be issued. Although in C/C++ null dereferences are not exceptions which can be caught in C++ try/catch blocks, it is possible to "catch" such an access violation by using (std::)signal() in C/C++ to specify a handler to be called when that signal is issued.
    • Some external C++ libraries, such as POCO C++ Libraries, include a NullPointerException class. Unlike Java, where java.lang.NullPointerException extends java.lang.RuntimeException, Poco::NullPointerException instead extends Poco::LogicException.[11]
  • In Cyclone, a failed null pointer check will throw a Null_Exception.
  • In D, much like C++, a null pointer dereference results in a segmentation fault.
  • In Delphi and many other Pascal implementations, the constant nil represents a null pointer to the first address in memory which is also used to initialize managed variables. Dereferencing it raises an external OS exception which is mapped onto a Pascal EAccessViolation exception instance if the System.SysUtils unit is linked in the uses clause.
  • In Java, access to a null reference (null) causes a NullPointerException (NPE), which can be caught by error handling code, but the preferred practice is to ensure that such exceptions never occur.
  • In .NET and C#, access to null reference (null) causes a System.NullReferenceException to be thrown. Although catching these is generally considered bad practice, this exception type can be caught and handled by the program.
  • In Objective-C, messages may be sent to a nil object (which is a null pointer) without causing the program to be interrupted; the message is simply ignored, and the return value (if any) is nil or 0, depending on the type.[12]
  • In Rust, dereferencing a null pointer (std::ptr::null()) in an unsafe block results in undefined behaviour, which usually results in a segmentation fault or corrupted memory.
  • Before the introduction of Supervisor Mode Access Prevention (SMAP), a null pointer dereference bug could be exploited by mapping page zero into the attacker's address space and hence causing the null pointer to point to that region. This could lead to code execution in some cases.[13]

Mitigation

While there could be languages with no nulls, most do have the possibility of nulls so there are techniques to avoid or aid debugging null pointer dereferences.[14] Bond et al. suggest modifying the Java virtual machine (JVM) to keep track of null propagation.[14]

There are three levels of handling null references, in order of effectiveness:

  1. languages with no null;
  2. languages that can statically analyse code to avoid the possibility of null dereference at run time;
  3. if null dereference can occur at runtime, tools that aid debugging.

Pure functional languages are an example of level 1 since no direct access is provided to pointers and all code and data is immutable. User code running in interpreted or virtual-machine languages generally does not suffer the problem of null pointer dereferencing.Script error: No such module "Unsubst".

Where a language does provide or utilise pointers which could become void, it is possible to avoid runtime null dereferences by providing compilation-time checking via static analysis or other techniques, with syntactic assistance from language features such as those seen in the Eiffel programming language with Void safety[15] to avoid null dereferences, D,[16] and Rust.[17]

In some languages analysis can be performed using external tools, but these are weak compared to direct language support with compiler checks since they are limited by the language definition itself.

The last resort of level 3 is when a null reference occurs at runtime, debugging aids can help.

History

In 2009, Tony Hoare stated[2][18] [19] that he invented the null reference in 1965 as part of the ALGOL W language. In that 2009 reference Hoare describes his invention as a "billion-dollar mistake": Template:Quote

See also

Notes

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. a b Script error: No such module "citation/CS1".
  3. ISO/IEC 9899, clause 6.3.2.3, paragraph 4.
  4. ISO/IEC 9899, clause 7.17, paragraph 3: NULL... which expands to an implementation-defined null pointer constant...
  5. ISO/IEC 9899, clause 6.3.2.3, paragraph 3.
  6. Script error: No such module "citation/CS1".
  7. a b ISO/IEC 9899, clause 6.5.3.2, paragraph 4, esp. footnote 87.
  8. Script error: No such module "citation/CS1".
  9. Script error: No such module "citation/CS1".
  10. Script error: No such module "citation/CS1".
  11. Script error: No such module "citation/CS1".
  12. Script error: No such module "citation/CS1".
  13. Script error: No such module "citation/CS1".
  14. a b Script error: No such module "citation/CS1".
  15. Script error: No such module "citation/CS1".
  16. Script error: No such module "citation/CS1".
  17. Script error: No such module "citation/CS1".
  18. Script error: No such module "citation/CS1".
  19. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

References

<templatestyles src="Refbegin/styles.css" />

  • Script error: No such module "citation/CS1".

Template:Nulls