This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GCC headers and DJGPP port (OT)




On Sun, 23 Jul 2000, Marc Espie wrote:
> 
> The reverse is not true, for obvious reasons: you're recreating information
> about a type that you don't have.

This is true in general.

It is absolute and utter crap when it comes to the constant magical
pointer that everybody agrees must exist: NULL. 

Any cast of a (type-less pointer) NULL pointer to another pointer is
obviously not "creating information". It's taking the source code as
written by the programmer, using the implicit pointer information in the
assignment to advantage. It's shorthand.

Whether you like the C notion of a "generic" type-less pointer (ie the C
"void *") or not is irrelevant. You obviously don't like it. I personally
think that the C++ anal behaviour wrt "void *" is just silly and rude. It
results in casts that shouldn't be there, which in turn can hide real
bugs. But that's a matter of personal opinion, and to all his own.

But NULL is not a "generic" type-less pointer. It's a very specific one.
As exemplified by the fact that historically there's been this silly
special case about casting the _integer_ 0 to a pointer. Which is truly
horrendous.

I think the __null approach of gcc is laudable and fine: it solves the
problem. I'm not arguing against it.

Basically I was just wondering why in the world gcc couldn't just
recognize the "((void *)0)" construct as equivalent to the new __null? Why
introduce a new keyword instead of just using accepted practice from C?

(Yes, I know some old-timers don't accept the "void *" thing, and think
NULL should be always defined to plain "0", but they should have the same
exact complaints about __null, and they can rot in hell anyway).

I assume it's some silly standard rule. I don't see that it makes any
technical difference, it just looks unnecessary..

		Linus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]