lkml.org 
[lkml]   [2020]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 1/2] system_data_types.7: Add 'void *'
From
Date
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.

\
 
 \ /
  Last update: 2020-10-02 19:03    [W:0.105 / U:2.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site