Suggestion add missing braces to single statement IF, FOR and WHILE etc.

Alec Davis <[email protected]>
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.