httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <>
Subject Re: cvs commit: apache-2.0/mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c
Date Sat, 31 Jul 1999 18:56:26 GMT
"Roy T. Fielding" wrote:
> >Imposing your preferred style on people without due process is
> >incredibly lame. I hate comparing to NULL. NULL is FALSE. Everyone knows
> >that (everyone with a clue, that is).
> NULL isn't FALSE.  NULL is a macro that represents a nonexistant pointer.
> The only reason it seems to be false is because, when evaluated within
> an integer expression, it has the value of a long 0, which is also how
> FALSE evaluates as an integer in C.  The warning exists because they are
> two different types and an assignment statement, unlike an if expression,
> isn't going to assume you wanted the type coerced to int unless you have
> warnings disabled.

Bearing in mind that the constant FALSE is not defined by C (in other
words, I meant that NULL is false in a boolean context), you are wrong.
NULL is false (lower case used to help make the point that I'm not
talking about some "false" constant) because if(NULL) fails. The warning
occurs because in the case in question we were trying to make a boolean
variable, which you can't do, so we used an integer as a standin, not
because NULL is not false.

If we had elected to use a pointer as a standin for a boolean, there
would have been no warning.

> A person who reads code as if pointers are the same as ints just because
> they have the same machine representation is going to screw up as soon as
> they get to pointer arithmetic.

This is very true, but since I haven't made that error, hardly relevant.

> I don't care what style you use, so long
> as you don't teach it to anyone else when I'm in the same room.

Try and stop me, big boy. ;-)

Or, alternatively, lecture me about C style when you've learnt it




"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

View raw message