Re: coding style (was Re: [PATCH][2.5] UTF-8 support in console)

From: Dave Jones (davej@codemonkey.org.uk)
Date: Sat May 31 2003 - 10:05:23 EST


On Sat, May 31, 2003 at 07:43:23AM -0700, Larry McVoy wrote:

> One other one is the
>
> if (!q) return;
>
> Chris said two lines, we don't do it that way. The coding style we use is
> a) one line is fine for a single statement.
> b) in all other cases there are curly braces

Saving a line over readability is utterly bogus.
Just look at some of the crap we have in devfs..

if (fs_info->devfsd_task == NULL) return (TRUE);
if (devfsd_queue_empty (fs_info) && fs_info->devfsd_sleeping) return TRUE;
if ( is_devfsd_or_child (fs_info) ) return (FALSE);
set_current_state (TASK_UNINTERRUPTIBLE);
add_wait_queue (&fs_info->revalidate_wait_queue, &wait);
if (!devfsd_queue_empty (fs_info) || !fs_info->devfsd_sleeping)
if (fs_info->devfsd_task) schedule ();
remove_wait_queue (&fs_info->revalidate_wait_queue, &wait);
__set_current_state (TASK_RUNNING);
return (TRUE);

*horror* to my eyes at least.

Parts of the DRI code use similar uglies. Whitespace is a *good* thing.
If you want more lines of code per screen, get a larger xterm, change a
font, whatever, but don't decrease code readability for something so bogus.

Dave

-
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/