source reformatting (add braces to if / else / while block) :

T

tvn

Hi, I am looking for a source reformatter that can put braces to if/
else/while block as shown below. I've looked at astyle and gnu indent
but they do not ha\
ve such option. Any recommendation ? Thanks ,



e.g.,

while(cond)
if (cond) stmt1
else if(cond) stmt2
else stmt3


to

while(cond){
if (cond) {
stmt1
}
else {
if(cond) {
stmt2
}
else { stmt3 }
}
}
 
R

Robert Fendt

Hi, I am looking for a source reformatter that can put braces to if/
else/while block as shown below. I've looked at astyle and gnu indent
but they do not ha\
ve such option. Any recommendation ? Thanks ,

Uncrustify (http://uncrustify.sourceforge.net/) claims to be
able to do just that, though I have not tried it myself.

Regards,
Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top