[MPlayer-dev-eng] [PATCH] libvo: GGI driver update

Rich Felker dalias at aerifal.cx
Fri Sep 9 02:41:40 CEST 2005


On Thu, Sep 08, 2005 at 11:54:03PM +0200, Christoph Egger wrote:
> 
> > Christoph Egger wrote:
> > > "if (arg)" is wrong, because it compares against the _number_ != 0,
> > > but arg is a pointer. See below.
> > 
> > No zero is special, see C99 6.3.2.3.3:
> > 
> >     An integer constant expression with the value 0, or such an
> >     expression cast to type void *, is called a null pointer constant...
> > 
> > if (arg) is not wrong.  The C++ standard is more clear about this, as it
> > type-converts to bool and there are clear rules about the conversion.  It
> > seems that C99 just says it's the same as (arg != 0), but by the above
> > paragraph, 0 is clearly a legal null pointer constant.  Off topic, but in
> > C++ NULL is often just #define to 0 because (void*)0 cannot be implicitly
> > converted to other pointer types.
> 
> bool is a new datatype in C, since C99. It has been backported from
> C++.

Typical C++ trolling, calling it "backported" as if C were some "old
version" of C++. Anyway "bool" type is totally irrelevant to this, and
it's not a keyword in C99 but a typedef defined by the useless
stdbool.h or something, IIRC (not positive about this tho -- check
it if you care).

> Now the question is, what requires (or better prefers) mplayer?
> C89 or C99?
> 
> If C89, then "if (arg != NULL)" is the only correct thing.

No, "if (arg)" has always been valid C and always will. Stop spamming
the list with false information and go RTFM about C. "if (arg)" does
not contain any cast, implicit or otherwise, to an integer type. It's
entirely a pointer conditional.

Rich




More information about the MPlayer-dev-eng mailing list