<<< Date Index >>>     <<< Thread Index >>>

Re: Little code cleanup



On Sat, Mar 08, 2008 at 08:02:54PM -0500, Derek Martin wrote:
> > K&R, 2nd Ed, p. 102
> > 
> >     Pointers and integers are not interchangeable.  Zero is the
> >     sole exception: the constant zero may be assigned to a
> >     pointer, and a pointer may be compared with the constant zero.
> 
> 
> K&R says you can compare a pointer to the [integer] constant zero.
> (void*)0 is not a[n integer] constant, it's a void pointer.  The
> warning is appropriate and does not conflict with K&R.

Derek D. Martin would like to recall this message... ;-)
In reading this and re-reading the preceding messages in the thread, I
got logically turned around a bit.  But despite K&R, it doesn't seem
particularly unintuitive that the compiler would warn in that case...
It may well be allowed, but still they are not the same type.  It
seems to me there are good cases for both arguments (warning and not
warning).

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

Attachment: pgp1LO3FLQpq3.pgp
Description: PGP signature