[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201002192814.14113-1-colomar.6.4.3@gmail.com>
Date: Fri, 2 Oct 2020 21:28:13 +0200
From: Alejandro Colomar <colomar.6.4.3@...il.com>
To: mtk.manpages@...il.com
Cc: Alejandro Colomar <colomar.6.4.3@...il.com>,
linux-man@...r.kernel.org, gcc-patches@....gnu.org,
libc-alpha@...rceware.org, eggert@...ucla.edu,
linux-kernel@...r.kernel.org, jwakely.gcc@...il.com,
David.Laight@...LAB.COM
Subject: [PATCH v5 0/2] Document 'void *'
Hi Michael,
Here I added a wfix fixing some wording issues and a few typos
spotted by Paul and Jonathan in the (many) threads.
As previously, it is squashed into a single commit.
Thanks again for those who reviewed the patch!
BTW, for those who don't have a local repo of the man-pages,
below you can see a rendered version of the patch.
Thanks,
Alex
[[
void *
According to the C language standard, a pointer to any object
type may be converted to a pointer to void and back. POSIX fur-
ther requires that any pointer, including pointers to functions,
may be converted to a pointer to void and back.
Conversions from and to any other pointer type are done implic-
itly, not requiring casts at all. Note that this feature pre-
vents any kind of type checking: the programmer should be care-
ful not to convert a void * value to a type incompatible to that
of the underlying data, because that would result in undefined
behavior.
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 void.
A value of this type can't be dereferenced, as it would give a
value of type 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 void or of a function as
1. A consequence of this is that sizeof is also allowed on void
and on function types, and returns 1.
The conversion specifier for void * for the printf(3) and the
scanf(3) families of functions is p.
Versions: The POSIX requirement about compatibility between void
* and function pointers was added in POSIX.1-2008 Technical Cor-
rigendum 1 (2013).
Conforming to: C99 and later; POSIX.1-2001 and later.
See also: malloc(3), memcmp(3), memcpy(3), memset(3)
See also the intptr_t and uintptr_t types in this page.
]]
Alejandro Colomar (2):
system_data_types.7: Add 'void *'
void.3: New link to system_data_types(7)
man3/void.3 | 1 +
man7/system_data_types.7 | 76 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 75 insertions(+), 2 deletions(-)
create mode 100644 man3/void.3
--
2.28.0
Powered by blists - more mailing lists