[asterisk-dev] Coding guidelines change (proposed)

Sergey Tamkovich serg at voipsolutions.ru
Tue Feb 26 14:36:51 CST 2008


Tzafrir Cohen пишет:
> 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
>
>   
Sorry, my previous message was useless, i thought i want an example of 
code where braces are missing.




More information about the asterisk-dev mailing list