This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC headers and DJGPP port (OT)
- To: gcc at gcc dot gnu dot org, torvalds at transmeta dot com
- Subject: Re: GCC headers and DJGPP port (OT)
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Sun, 23 Jul 2000 14:51:27 -0400
Linus Torvalds <torvalds@transmeta.com>:
> Off-topic: why is it exactly that C++ doesn't like the "((void *)0)"
> thing, which as far as I can tell has all the same advantages? Was it
> purely a "stupid standard" issue, or is there some actual real deeper
> reason for it?
Real reasons, which several people will probably have already explained
by the time this message makes it out... Can't pass pointer-to-void into
a function taking pointer-to-foo without explicit casts.
> That was one of my pet peeves about C++: I always considered the
> historical "#define NULL 0" to be complete braindamage due to lack of
> even the simplest kind of type-checking (and matching to a pointer type
> is just one small portion of that type-checking - getting sane and
> appropriate warnings is quite important).
Funny, that's always been one of my pet peeves about C. :-)
> And C++ made the ANSI-C-approved "((void *)0)" define illegal for some
> reason that I still haven't quite grasped.
It's legal only in the absence of strong(er) typechecking. It's arguable
that special exceptions should have been made in the case of zero (however
you spell it), but it's also arguable that special cases lead to bigger
problems, namely in the field of teaching new programmers.
Phil