Coding style updates

Michael Adam ma at sernet.de
Fri Oct 19 09:03:47 GMT 2007


On Fri, Oct 19, 2007 at 10:39:18AM +0200, Stefan (metze) Metzmacher wrote:
> Hi,
> 
> here're are some updates to the README.Coding,
> please review and comment.
> 
> metze
> 

> From 021144e64eea66d1d526c044e399a39ef966a189 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Fri, 19 Oct 2007 09:53:32 +0200
> Subject: [PATCH] [Coding Style] add more examples about how braces should be used
> 
> -If the beginning statement has to be broken across lines due to length,
> -the beginning brace should be on a line of its own.

I don't agree upon removing this rule. 

To my taste this is good:

> 	for (very_long_var_name_x=1;
> 	     very_long_var_name_x<10;
> 	     very_long_var_name_x++)
> 	{
>		print("%d\n", very_long_var_name_x);
>  	}

and this is really bad:

> 	for (very_long_var_name_x=1;
> 	     very_long_var_name_x<10;
> 	     very_long_var_name_x++) {
>  		print("%d\n", very_long_var_name_x);
>  	}

In this case, putting the opening brace into a line of its own
(and unindented) *greatly* enhances readability. In the second
example, it is hard to see at the first glance where the body of
the loop begins.

Michael

-- 
Michael Adam <ma at sernet.de>
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.SerNet.DE, mailto: Info @ SerNet.DE


More information about the samba-technical mailing list