diff options
| author | Alejandro Colomar <alx.manpages@gmail.com> | 2022-07-21 00:35:07 +0200 |
|---|---|---|
| committer | Alejandro Colomar <alx.manpages@gmail.com> | 2022-07-21 00:35:07 +0200 |
| commit | 3e33f851dd7d6b7dfaccae79cdf4af97e6fd90bb (patch) | |
| tree | 5bb99f1ed496dac120250644964583b775123140 | |
| parent | c5434ec8e5ca0ade5544e2409209679a6560f884 (diff) | |
| download | man-pages-3e33f851dd7d6b7dfaccae79cdf4af97e6fd90bb.tar.gz | |
void.3, void.3type, system_data_types.7: Move void* to a separate page
Also fix the page to be in man3type, not in man3.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
| -rw-r--r-- | man3/void.3 | 1 | ||||
| -rw-r--r-- | man3/void.3type | 76 | ||||
| -rw-r--r-- | man7/system_data_types.7 | 73 |
3 files changed, 76 insertions, 74 deletions
diff --git a/man3/void.3 b/man3/void.3 deleted file mode 100644 index db50c0f091..0000000000 --- a/man3/void.3 +++ /dev/null @@ -1 +0,0 @@ -.so man7/system_data_types.7 diff --git a/man3/void.3type b/man3/void.3type new file mode 100644 index 0000000000..9562e3f5f8 --- /dev/null +++ b/man3/void.3type @@ -0,0 +1,76 @@ +.\" Copyright (c) 2020-2022 by Alejandro Colomar <colomar.6.4.3@gmail.com> +.\" and Copyright (c) 2020 by Michael Kerrisk <mtk.manpages@gmail.com> +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.\" +.TH VOID 3type 2022-07-20 Linux "Linux Programmer's Manual" +.SH NAME +void \- abstract type +.SH SYNOPSIS +.nf +.B void * +.fi +.SH DESCRIPTION +According to ISO C, +a pointer to any object type may be converted to a pointer to +.I void +and back. +POSIX further requires that any pointer, +including pointers to functions, +may be converted to a pointer to +.I void +and back. +.PP +Conversions from and to any other pointer type are done implicitly, +not requiring casts at all. +Note that this feature prevents any kind of type checking: +the programmer should be careful not to convert a +.I void * +value to a type incompatible to that of the underlying data, +because that would result in undefined behavior. +.PP +This type is useful in function parameters and return value +to allow passing values of any type. +The function will typically use some mechanism to know +the real type of the data being passed via a pointer to +.IR void . +.PP +A value of this type can't be dereferenced, +as it would give a value of type +.IR void , +which is not possible. +Likewise, pointer arithmetic is not possible with this type. +However, in GNU C, pointer arithmetic is allowed +as an extension to the standard; +this is done by treating the size of a +.I void +or of a function as 1. +A consequence of this is that +.I sizeof +is also allowed on +.I void +and on function types, and returns 1. +.SS Use with printf(3) and scanf(3) +The conversion specifier for +.I void * +for the +.BR printf (3) +and the +.BR scanf (3) +families of functions is +.BR p . +.SH VERSIONS +The POSIX requirement about compatibility between +.I void * +and function pointers was added in +POSIX.1-2008 Technical Corrigendum 1 (2013). +.SH CONFORMING TO +C99 and later. +POSIX.1-2001 and later. +.SH SEE ALSO +.BR malloc (3), +.BR memcmp (3), +.BR memcpy (3), +.BR memset (3), +.BR intptr_t (3type) diff --git a/man7/system_data_types.7 b/man7/system_data_types.7 index 3f2ee2693b..945837c2ca 100644 --- a/man7/system_data_types.7 +++ b/man7/system_data_types.7 @@ -589,79 +589,6 @@ C99 and later; POSIX.1-2001 and later. .BR va_end (3) .RE .\"------------------------------------- void * -----------------------/ -.TP -.I void * -.RS -According to the C language standard, -a pointer to any object type may be converted to a pointer to -.I void -and back. -POSIX further requires that any pointer, -including pointers to functions, -may be converted to a pointer to -.I void -and back. -.PP -Conversions from and to any other pointer type are done implicitly, -not requiring casts at all. -Note that this feature prevents any kind of type checking: -the programmer should be careful not to convert a -.I void * -value to a type incompatible to that of the underlying data, -because that would result in undefined behavior. -.PP -This type is useful in function parameters and return value -to allow passing values of any type. -The function will typically use some mechanism to know -the real type of the data being passed via a pointer to -.IR void . -.PP -A value of this type can't be dereferenced, -as it would give a value of type -.IR void , -which is not possible. -Likewise, pointer arithmetic is not possible with this type. -However, in GNU C, pointer arithmetic is allowed -as an extension to the standard; -this is done by treating the size of a -.I void -or of a function as 1. -A consequence of this is that -.I sizeof -is also allowed on -.I void -and on function types, and returns 1. -.PP -The conversion specifier for -.I void * -for the -.BR printf (3) -and the -.BR scanf (3) -families of functions is -.BR p . -.PP -.IR Versions : -The POSIX requirement about compatibility between -.I void * -and function pointers was added in -POSIX.1-2008 Technical Corrigendum 1 (2013). -.PP -.IR "Conforming to" : -C99 and later; POSIX.1-2001 and later. -.PP -.IR "See also" : -.BR malloc (3), -.BR memcmp (3), -.BR memcpy (3), -.BR memset (3) -.PP -See also the -.I intptr_t -and -.I uintptr_t -types in this page. -.RE .\"--------------------------------------------------------------------/ .SH NOTES The structures described in this manual page shall contain, |
