[asterisk-dev] Coding guidelines change (proposed)

Tzafrir Cohen tzafrir.cohen at xorcom.com
Wed Feb 27 12:20:27 CST 2008


On Wed, Feb 27, 2008 at 06:28:38PM +0200, Atis Lezdins wrote:

> How about allowing single line if's, when they are short and simple
> construction (let's say - up to 60 symbols):
> 
>   if(a!=1) b=2;
>   if(!ast_strlen_zero(c)) ast_do_something(c);
> 
> They don't have mis-indentation and when adding another line, it's
> very noticeable that braces need to be added. IMHO this would allow
> easier reading of code.

I tend to read those as:

  if ( (a!=1) b=2 )
    /* then ? */

if ( (!ast_strlen_zero(c)) ast_do_something(c) )
    /* then ? */

It takes too much human parsing time to find the action taken.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-dev mailing list