|
 |
clipka wrote:
> Darren New <dne### [at] san rr com> wrote:
>> People often mistakenly argue that C++ guarantees the bit pattern is
>> zero because you now write { char* x = 0; } instead of { char* x = NULL; }
>
> BTW, those are perfectly identical according to the C99 spec: NULL *is* either
> defined as the numeric literal 0, or the very same cast to void*.
I know that. I was under the impression that C++ got rid of the possibility
of it being a cast, and strongly suggested people just use the literal 0.
> People forget though that char* x = 0 actually involves an implicit typecast -
> just like they forget (or never learn in the first place) that a typecast in C
> does *not* necessarily preserve the binary representation...
Yes. Well of course { float f = 2; } involves a change in the
representation. A lot of people also forget that pointers to functions have
different rules from pointers to data (like, you can't cast them to void*
reliably).
--
Darren New, San Diego CA, USA (PST)
"We'd like you to back-port all the changes in 2.0
back to version 1.0."
"We've done that already. We call it 2.0."
Post a reply to this message
|
 |