[MPlayer-dev-eng] [PATCH] mplayer.c
Oded Shimon
ods15 at ods15.dyndns.org
Mon Mar 28 10:15:01 CEST 2005
On Sun, Mar 27, 2005 at 10:17:54PM -0500, D Richard Felker III wrote:
> 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..).
If you want to be really anal, the "correct" thing to put is '(char *)0', but
I don't think there is any modern architecture where this matters. This patch
is totally useless, because NULL already is '(void *)0'.
- ods15
More information about the MPlayer-dev-eng
mailing list