Re: [PATCH v4 1/2] system_data_types.7: Add 'void *'
From: Paul Eggert
Date: Fri Oct 02 2020 - 13:02:27 EST
On 10/2/20 8:14 AM, Alejandro Colomar wrote:
+.I void *
GNU style is a space between "void" and "*", so this should be '.I "void\ *"',
both here and elsewhere. The backslash prevents a line break.
+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 cast a
Change "cast" to "convert", since the point is that no cast is needed.
+.PP
+The conversion specifier for
+.I void *
+for the
+.BR printf (3)
+and the
+.BR scanf (3)
+families of functions is
+.BR p ;
+resulting commonly in
+.B %p
+for printing
+.I void *
+values.
%p works with any object pointer type (or in POSIX, any pointer type), not just
void *.
Should also mention "void const *", "void volatile *", etc. Plus it really
should talk about plain "void", saying that it's a placeholder as a return value
for functions, for casting away values, and as a keyword in C11 for functions
with no parameters (though this is being changed in the next C version!). I sent
comments about most of this stuff already.