[asterisk-dev] Coding guidelines change (proposed)

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Feb 26 15:20:46 CST 2008


On Tue, Feb 26, 2008 at 11:06:31PM +0300, Sergey Tamkovich wrote:
> Tzafrir Cohen пишет:
> > On Tue, Feb 26, 2008 at 11:46:37AM -0600, Tilghman Lesher wrote:
> >   

> >> While this
> >> is legal C, it has caused a number of issues in the past, where another
> >> statement was added at that indentation level, but without adding the
> >> necessary braces.
> >
> > Could you please point to one or two such cases?
> >
> > Current coding guidelines already require that a nested block will have
> > braces. I wonder if those issues are related to bad indentation.
> >
> micron:/usr/src/asterisk-1.4 # grep if */*.c | grep -v "\{"
> 
> apps/app_dial.c
> 
> 435 if (option_verbose > 2)
> 436 ast_verbose( VERBOSE_PREFIX_2 "Everyone is busy/congested at this 
> time (%d:%d/%d/%d)\n", numlines, numbusy, numcongestion, numnochan);

So you're saying that there's bad indentation here?

Bad indentation is something that should be fixed regardless.

Is the following code clear to you?

#ifdef WE_CAN_DO_FOO
if (!foo->bar) {
#endif
	a()
	b()
	c()
#ifdef WE_CAN_DO_FOO
}
#endif

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