Messages in this thread | | | From | Kyle Moffett <> | Subject | Re: [PATCH] Use NULL instead of integer 0 in security/selinux/ | Date | Fri, 9 Jul 2004 21:43:18 -0400 |
| |
On Jul 09, 2004, at 19:49, Paul Jackson wrote: > I suspect not. Up to Linus. This is all about writing code that > doesn't bite. > > Since mostly it's us humans doing the writing, this is more a human > engineering problem than a pure mathematics problem such as Dijkstra > or Wirth were closer to addressing. > > Let someone with demonstrated good taste dictate the style choices > that lead to short, sweat, but seldom screwy code. > > It's all arbitrary as hell. The proof is in the pudding.
The place this probably matters most is in various function calls. For example, given the following prototype, (and ignoring the fact that gcc is generally able to properly compile all of these), which is the most clear? These are all "logically" correct, for the most part, but as humans we have certain readability standards.
int some_function(int a, void *b, char *c, unsigned char d, int e);
A) int res = some_function(0,0,0,0,0); B) int res = some_function(NULL,NULL,NULL,NULL,NULL); C) int res = some_function(0,NULL,NULL,'\0',0);
C is the most expressive of the intent of the code, and the least likely to contain bugs.
Cheers, Kyle Moffett
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |