Suggested advantages of this style are that the starting brace needs no extra line alone; and the ending brace lines up with the statement it conceptually belongs to. One cost of this style is that the ending brace of a block needs a full line alone, which can be partly resolved in if/else blocks and do/while blocks:
void checknegative(x) {
if (x < 0) {
puts("Negative");
} else {
nonnegative(x);
}
}
There are many mentions of The One True Brace Style out there, but there is some confusion as to its true form. Some sources say it is the variation specified above[8], while others note it as just another "hacker jargon" term for K&R[1].
Top comments (0)