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

From: Timothy Miller
Date: Thu Jul 08 2004 - 11:32:13 EST




Linus Torvalds wrote:


I've seen too damn many people mistake NULL and NUL (admit it, you've seen it too), and I've seen code like

char c = NULL;

THIS is simply a case of the programmer not understanding what NULL means. When I use '0' for a pointer, I know EXACTLY what I mean, and I also know when '0' might be ambiguous, and when I don't know what I'm allowed to do, then I play it REALLY safe and typecast 0 to exactly the pointer type I need.

I suppose it's good form to use the safest syntax in all cases. Good for readability for people who need more redundancy to read the code.

Perhaps the Linux kernel should have a convention where all NULL pointers are typecast explicitly. I can hear the cries of pain already. :)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/