lkml.org 
[lkml]   [2004]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Use NULL instead of integer 0 in security/selinux/
Date
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/

\
 
 \ /
  Last update: 2005-03-22 14:04    [from the cache]
©2003-2011 Jasper Spaans