NULL v. zero
Posted Jul 15, 2004 15:41 UTC (Thu) by
ikm (subscriber, #493)
In reply to:
NULL v. zero by elanthis
Parent article:
NULL v. zero
The fact that a NULL pointer is just 0 is not an implementation detail. It is not really a value -- it is a standard *syntax* to say that you want a pointer to be null. Please read my comment a bit more thourough, it is all there. It has nothing to do with weak type checking either. As a matter of fact, this works the very same way in C++, that is, null pointer constant is 0. In C/C++, the compiler always knows what you mean, judging from the context (is it a pointer being assigned or an integer? the compiler knows).
In case it was really about coding styles and not about the language, this is all moot anyway. People could use 0 as NULL, and it would be perfectly legal and correct, as long as they don't participate in kernel development that way. Sorry guys, I overlooked that.
Btw, the quoted "int i = NULL" is always incorrect, and that's the language issue, not a style issue.
(
Log in to post comments)