[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Suggestion add missing braces to single statement IF, FOR and WHILE etc.
From: |
Alec Davis |
Subject: |
Suggestion add missing braces to single statement IF, FOR and WHILE etc. |
Date: |
Thu, 16 Oct 2008 00:23:38 +1300 |
Slight formatting opps in previous email.
The Open Source PABX guidelines
http://svn.digium.com/view/asterisk/trunk/doc/CODING-GUIDELINES?view=markup
call for braces to be everywhere. The existing codebase has nearly
everywhere previously not required this. Creating a dilemma for modifying
code.
- No nested statements without braces, e.g.:
for (x = 0; x < 5; x++)
if (foo)
if (bar)
baz();
instead do:
for (x = 0; x < 5; x++) {
if (foo) {
if (bar) {
baz();
}
}
}
Currently, 'indent -br' only moves an existing { to the same line as the IF,
any chance of adding a parameter to insert missing braces?
Regards Alec Davis