The original meaning of the network word null is empty. In computers, it usually means a null value, no result, or an empty set. Programs usually use null pointers to express conditions; the end of a list of unknown length or some operations have not been performed. This use of null pointers can be compared with Nothing values in nullable and option types.
#The operating environment of this article: Windows 7 system, Dell G3 computer.
NullThe original meaning is "empty; the elements are only zero". In computers, it usually means a null value, no result, or an empty set. Programs often use null pointers to represent conditions, such as the end of a list of unknown length or that some operation was not performed; this use of null pointers can be compared with the Nothing value in nullable and option types.
Null pointers should not be confused with uninitialized pointers: a null pointer is guaranteed to be compared with any pointer to a valid object. However, depending on the language and implementation, uninitialized pointers may not have any such guarantees.
Extension information
In fact, dereferencing a null pointer may cause an attempt to read or write from unmapped memory, thus triggering fragmentation Error or memory access violation. This may manifest as a program crash, or translate into a software exception that can be caught by the program code.
However, in some cases this is not the case. For example, in x86 real mode, address 0000:0000 is readable and usually also writable, and dereferencing a pointer to that address is a perfectly valid but generally undesirable operation that can lead to undefined but undesirable behavior in your application. Non-crash behavior.
Sometimes it is helpful and unambiguous to dereference a pointer with address zero; for example, BIOS code written in C for a 16-bit real-mode x86 device can be written to the machine by dereferencing a null pointer. IDT at physical address 0. The compiler can also optimize out null pointer dereferences, avoiding segmentation faults but causing other undesirable behavior.
Related free learning recommendations: Programming videos
The above is the detailed content of What does the network word null mean?. For more information, please follow other related articles on the PHP Chinese website!