Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] Re: Coding style (was: Re: Re: cinergyT2: which kernel/usb module to use?)
On Mon, Nov 29, 2004 at 04:39:01AM +0100, Oliver Endriss wrote:
> w-thiel@gmx.net wrote:
> > if (something) {
> > doit();
> > } else {
> > that();
> > and_that();
> > }
> > IMHO, this is perfectly readable.
>
> Anyway, I prefer something like this:
>
> | if (something)
> | doit();
> | else
> | {
> | that();
> | and_that();
> | }
I had this argument with a computer science prof when I was a student
(a few years ago now). He argued for the former, I for the latter (with
the braces on separate lines).
His argument was that the braces are for the compiler's benefit only; a
human gets the block structure by looking at the indenting instead.
Lines just with opening/closing braces just spread out the code and mean
you fit less code on-screen. He convinced me.
I note that the Python guys have gone one step further and made the
compiler follow the indents.
Braces around a single statement are good for safety (eg Perl requires
them). Did you mean to say that the kernel guys don't allow it?
Hamish
--
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>
Home |
Main Index |
Thread Index