diff options
| author | Alejandro Colomar <alx@kernel.org> | 2024-04-26 15:06:49 +0200 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2024-05-02 01:24:19 +0200 |
| commit | dcde2f70372b49ec43efc5db864c9ff585d0a2dd (patch) | |
| tree | 78b9b7425130e4a5858e4c01a524d802423879ed /man/man3const/NULL.3const | |
| parent | 12aca537ce78a41bbcdaf485209691e10f8002d7 (diff) | |
| download | man-pages-dcde2f70372b49ec43efc5db864c9ff585d0a2dd.tar.gz | |
man/, share/mk/: Move man*/ to man/
This is a scripted change:
$ mkdir man/;
$ mv man* man/;
$ ln -st . man/man*;
$ find share/mk/ -type f \
| xargs grep -l '^MANDIR *:=' \
| xargs sed -i '/^MANDIR *:=/s,$,/man,';
$ find share/mk/dist/ -type f \
| xargs grep -l man \
| xargs sed -i 's,man%,man/%,g';
Link: <https://lore.kernel.org/linux-man/YxcV4h+Xn7cd6+q2@pevik/T/>
Cc: Petr Vorel <pvorel@suse.cz>
Cc: Jakub Wilk <jwilk@jwilk.net>
Cc: Stefan Puiu <stefan.puiu@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man/man3const/NULL.3const')
| -rw-r--r-- | man/man3const/NULL.3const | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/man/man3const/NULL.3const b/man/man3const/NULL.3const new file mode 100644 index 0000000000..e395628a92 --- /dev/null +++ b/man/man3const/NULL.3const @@ -0,0 +1,74 @@ +.\" Copyright (c) 2022 by Alejandro Colomar <alx@kernel.org> +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.\" +.TH NULL 3const (date) "Linux man-pages (unreleased)" +.SH NAME +NULL \- null pointer constant +.SH LIBRARY +Standard C library +.RI ( libc ) +.SH SYNOPSIS +.nf +.B #include <stddef.h> +.P +.B "#define NULL ((void *) 0)" +.fi +.SH DESCRIPTION +.B NULL +represents a null pointer constant, +that is, a pointer that does not point to anything. +.SH CONFORMING TO +C99 and later; +POSIX.1-2001 and later. +.SH NOTES +The following headers also provide +.BR NULL : +.IR <locale.h> , +.IR <stdio.h> , +.IR <stdlib.h> , +.IR <string.h> , +.IR <time.h> , +.IR <unistd.h> , +and +.IR <wchar.h> . +.SH CAVEATS +It is undefined behavior to dereference a null pointer, +and that usually causes a segmentation fault in practice. +.P +It is also undefined behavior to perform pointer arithmetic on it. +.P +.I NULL \- NULL +is undefined behavior, according to ISO C, but is defined to be 0 in C++. +.P +To avoid confusing human readers of the code, +do not compare pointer variables to +.BR 0 , +and do not assign +.B 0 +to them. +Instead, always use +.BR NULL . +.P +.B NULL +shouldn't be confused with +.BR NUL , +which is an +.BR ascii (7) +character, +represented in C as +.BR \[aq]\e0\[aq] . +.SH BUGS +When it is necessary to set a pointer variable to a null pointer, +it is not enough to use +.BR memset (3) +to zero the pointer +(this is usually done when zeroing a struct that contains pointers), +since ISO C and POSIX don't guarantee that a bit pattern of all 0s +represent a null pointer. +See the EXAMPLES section in +.BR getaddrinfo (3) +for an example program that does this correctly. +.SH SEE ALSO +.BR void (3type) |
