LWN.net Logo

Re: [PATCH] Use NULL instead of integer 0 in security/selinux/

Re: [PATCH] Use NULL instead of integer 0 in security/selinux/

Posted Jul 22, 2004 19:35 UTC (Thu) by h.j.thomassen (guest, #15232)
Parent article: Re: [PATCH] Use NULL instead of integer 0 in security/selinux/

I support Linus' view that NULL should be written if a pointer is meant to be zero. But his statement "NULL is _not_ an integer. Never has been,..." is historically incorrect. Read K&R, 2nd Ed, page 102 where it clearly says the opposite.

int i = NULL; is wrong, and always has been.
char *p = 0; may be undesirable, but is syntactically correct.

Since the second statement is syntactically correct, no compiler will complain. Since compilers will not force you to write "char *p = NULL;" it deserves a place in the kernel coding standards.


(Log in to post comments)

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