[asterisk-dev] Coding guidelines change (proposed)
Sergey Tamkovich
serg at voipsolutions.ru
Tue Feb 26 14:06:31 CST 2008
Tzafrir Cohen пишет:
> On Tue, Feb 26, 2008 at 11:46:37AM -0600, Tilghman Lesher wrote:
>
>> I'd like to propose a change to the coding guidelines, and I'm airing it here
>> for specific feedback before we make this change. Currently, our standard
>> is that if you have a single statement following an if/for/while construct,
>> then we do not require parentheses around the single statement. 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.
>>
>> I'd like to change the coding guidelines that the braces are no longer
>> optional; that they are mandatory, and if this change is approved, a janitor
>> project will be posted shortly to convert legacy code to the new standard.
>>
>
> Sounds like a good idea. How good is indent in that task?
>
>
>> Are there any comments or objections before we implement this change?
>>
>
> 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);
More information about the asterisk-dev
mailing list