Hi Willy,
On Sun, 4 Aug 2002, Willy Tarreau wrote:
> It is always bad to ignore the compiler's complaints, because it tells
> you that it may do things wrong when it's not sure about what you want.
> [snip] specially when indentation fools you. Eg, this common mistake :
>
> if (something1)
> if (something 2)
> do_2();
> else
> do_not_1();
You are quite right. Compilations should be SILENT. How else do you
know nothing's wrong? I would rewrite (refactor?) the code above as:
if( something1 )
{
if( something2 ) { do_2(); }
}
else
{
do_not_1();
}
and yes I use two spaces, not tabs, to indent, so I don't fall off the
page; and yes, I always use the braces, even in a one-liner; and yes,
I put the braces there and not like K&R, so I can see the buggers.
Also I NULL all my pointers immediately after declaring them AND after
using them, and I check they're not NULL before using them, which
prevents loads of segfault type errors when I screw up and...
But in trying to change the world, you're wasting time (and bandwidth :).
73,
Ged.
-
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/
This archive was generated by hypermail 2b29 : Wed Aug 07 2002 - 22:00:24 EST