[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BA7CCC5.5020302@intcomgrp.com>
Date: Mon, 22 Mar 2010 16:02:13 -0400
From: James Kosin <jkosin@...comgrp.com>
To: linux-kernel@...r.kernel.org
Subject: [OT] Style Issues / Concerns
Everyone,
1) Please forgive me if this is the wrong forum to post this.
2) Please CC me when replying... I'm having list issues right now.
3) Questions / Concerns:
I'm a bit confused as to why there has been a style push to remove
braces {} from the code.
Long ago, code was often missing these braces for exactly the point many
patches are now coming back and reverting back to this antiquated style.
The problem was, and the reason the style changed to include these
braces, was to prevent the common problem of forgetting the braces when
adding another statement to the if or else block of the code.
Example:
if( (x != 0) )
flag = true;
else
flag = false;
----
if( (x != 0) )
flag = true;
call_something();
else
flag = false;
----
Before everyone jumps in at once, this is a simple example that will
produce a compiler error about the misplaced else. However if there are
many if statements above this that may allow the else to be paired up
with it then the code will compile and there will be a serious and very
difficult bug in the code that will take days or months to find.
Why has the style for this changed back?
Does the compiler produce smaller code without the braces {}?
Just my 2-cents,
James Kosin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists