Mail Archives: djgpp-workers/1998/03/27/05:47:32
I wrote:
> DJ's remark seems to imply otherwise (a modifyable lvalue, which makes a
> large difference), so, I have to check whether this holds a truth.
After some tests: it is definitely a ((non-modifiable)) rvalue.
> > 3. ANSI C explicitly states that NULL must be one of the following: 0,
> > 0L, or (void *)0.
>
> I read in one of the latest C drafts (yes, a draft, hence no accepted
> standard) that (void*)0 is NOT an acceptable definition for NULL, but 0,
> 0L, 0LU and even, but not for us, 0LLU are.
> But as __null is NOT C, but C++ this does not matter.
I'll correct myself:
in C, (void*)0 is valid as definition of NULL, and so are 0 and 0L.
in C++, (void*)0 is not allowed as definition of NULL, but 0 and 0L (and
maybe __null) are.
The reason why it is not allowed is that, the following expression
should produce no errors:
c_String *t = NULL;
When NULL is (void*)0, this will produce a warning (should be an error)
because (void*)0 is NOT the nil-pointer constant, and implicit assigning
from a different pointer type is never allowed in C++, at least not for
non-inherited classes.
C++ was supposed to be a superset of C, but it IS not.
Having such a small difference won't harm anyone.
--
\ Vik /-_-_-_-_-_-_/
\___/ Heyndrickx /
\ /-_-_-_-_-_-_/
- Raw text -