[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (rc4) now available
- From: Miles Bader <miles@...>
- Date: Thu, 01 Dec 2011 18:51:54 +0900
Enrico Colombini <erix@erix.it> writes:
>> "0" should be perfectly acceptable in a pointer context; this sounds
>> like a bug with the C compiler...
>
> That's in C++.
It's acceptable in both C and C++.
> In C, if I remember correctly, there is no automatic conversion and
> the integer/pointer types could be incompatible on some hardware.
You remember incorrectly. Both C and C++ will automatically do the
implicit conversion of a "0" in the source code to the appropriate
pointer type in a pointer context.
Remember, we're talking about "0" in the source code, not a run-time
value of zero; a NULL pointer may indeed have a non-zero value at
runtime.
-Miles
--
Circus, n. A place where horses, ponies and elephants are permitted to see
men, women and children acting the fool.