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

From: Eyal Lebedinsky
Date: Sat Jul 10 2004 - 21:46:17 EST


Roland Dreier wrote:
Suppose I have

struct foo {
int a;
int b;
};

then sparse is perfectly happy with someone clearing out a struct foo
like this:

struct foo bar = { 0 };

but then if someone changes struct foo to be

struct foo {
void *x;
int a;
int b;
};

sparse will complain about that initialization, and all of the fixes
I can think of seem somewhat worse than the original to me:

Come on, this is madness. By accident, the first memeber which
changed from 'int' to 'void *' now accepts the old initializer.
In my book this is a really bad thing because you just changed
the semantics of the initialiser '{ 0 }' quietly.

BTW, if nothing else, don't add new members at the top.

--
Eyal Lebedinsky (eyal@xxxxxxxxxxxxxx)
-
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/