[MPlayer-dev-eng] [PATCH] mplayer.c

D Richard Felker III dalias at aerifal.cx
Mon Mar 28 05:17:54 CEST 2005


On Sun, Mar 27, 2005 at 07:23:06PM -0600, Joey Parrish wrote:
> On Sun, Mar 27, 2005 at 09:10:39PM +0200, Björn Sandell wrote:
> > Avoid some missing sentinel warnings.
> 
> > -          if (execlp("gdb", "gdb", prog_path, spid, NULL) == -1)
> > +          if (execlp("gdb", "gdb", prog_path, spid, (void *)NULL) == -1)
> 
> > -          execl("/bin/sh","sh","-c",cmd->args[0].v.s,NULL);
> > +          execl("/bin/sh","sh","-c",cmd->args[0].v.s,(void *)NULL);
> 
> This is silly.  There should be no need to cast compatible constants.
> 
> 1) NULL should always be assumed to be a pointer (common sense)
> 2) even treating NULL as int, C doesn't care about such stupid
>     casting, only C++ would complain
> 
> What good is this patch?  What is sentinel?

Actually with functions which take a variable number of arguments, it
_does_ matter, since there is no profile to force the right promotion
of 0 to a pointer type. However, NULL is already (void*)0, so this is
nonsense (strictly speaking C allows it to be defined as 0 I think,
but no sane implementation does that..).

Rich




More information about the MPlayer-dev-eng mailing list