LWN.net Logo

NULL v. zero

NULL v. zero

Posted Jul 15, 2004 18:23 UTC (Thu) by dvdeug (subscriber, #10998)
In reply to: NULL v. zero by ikm
Parent article: NULL v. zero

Yes, it is weak type checking. The only way C++ is a strong type checking language is if you compare it to C or Assembly. If you used Ada or Java, or any of a hundred different languages, you couldn't convert a constant of type integer to a pointer. 0, standing alone in a strong typing system is not ambigious, and it doesn't change type depending on what things you stick around it.


(Log in to post comments)

NULL v. zero

Posted Jul 15, 2004 23:03 UTC (Thu) by ikm (subscriber, #493) [Link]

It is not a weak type checking, it is the absence of any type checking at all is some cases. It is not the language itself which imposes this absence, it is libraries that do. All that ellipsis functions for instance, as an execl example above. These prototypes doesn't give the compiler any clue about the types at all, so it can't apply any type checking in these cases. In case the compiler knows about types, it will act accordingly, converting zeroes to null pointers when applicable.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds