On Thu, Nov 01, 2012 at 12:41:17AM -0200, Rafael wrote:
> Hi tech@,
> 
> The diff below replaces "err(1, (char *)NULL);" with "err(1, NULL);" on
> usage example of error functions in style(9) manpage. The casting seems to
> be a leftover from the changes from revision 1.38 to 1.39.
> 

fixed, thanks!
jmc

> Before 1.39 the text stated that "Use NULL instead of (type\ *)0 or (type\
> *)NULL in (type\ *)0 or (type\ *)NULL in contexts where the compiler knows
> the  type, e.g., in assignments. Use (type\ *)NULL in other contexts, in
> particular for all function args. (Casting is essential for variadic args
> and is necessary for other args  if the function prototype might not be in
> scope.)".
> 
> From revision 1.39 on the guidelines changed towards use casting only in
> variadic parameters, as text says "Use NULL instead of (type\ *)0 or (type\
> *)NULL in all cases except for arguments to variadic functions where the
> compiler does not know the type.".
> 
> In this case, the argument type is known. Further, this changes conforms
> with usage example in err(9) manpage.
> 
> Thanks
> 
> Index: style.9
> ===================================================================
> RCS file: /cvs/src/share/man/man9/style.9,v
> retrieving revision 1.53
> diff -u -p -r1.53 style.9
> --- style.9   11 Apr 2012 21:09:23 -0000      1.53
> +++ style.9   1 Nov 2012 02:25:39 -0000
> @@ -534,7 +534,7 @@ or
>  don't roll your own!
>  .Bd -literal -offset indent
>  if ((four = malloc(sizeof(struct foo))) == NULL)
> -     err(1, (char *)NULL);
> +     err(1, NULL);
>  if ((six = (int *)overflow()) == NULL)
>       errx(1, "Number overflowed.");
>  return (eight);

Reply via email to