Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the name of this particular indent style? ("braces stacked")

I've seen this questions here. I'm wondering if there exists an official name for the following indent style:

void fooBar(String s)
{
    while (true)
    {
        // ... do something
    }
}

When the opening brace is in the same line as the control statement, the statements within are indented and the closing brace is on the same indentation level as the control statement, the style is called K&R-Style. So is there a name for the indent style for the this code sample above?

like image 682
Ludwig Wensauer Avatar asked Jan 03 '09 09:01

Ludwig Wensauer


2 Answers

Allman style (bsd in Emacs) see wikipedia article http://en.wikipedia.org/wiki/Indent_style

like image 154
Jesse Pepper Avatar answered Nov 15 '22 10:11

Jesse Pepper


Yep, this is the ANSI style, called this way because it appears in the ANSI C documents. The popular auto-formatting util astyle refers to it as ansi

AFAIK, It's also the one used by default in Visual C++.

like image 42
Eli Bendersky Avatar answered Nov 15 '22 09:11

Eli Bendersky