Can someone tell me if my C ++ indentation style is named? (an example is given)

I am learning C ++. For me, my programming style is what looks best; it does not seem to comply with the rules of any particular style. Here is an example

void f(int x){ //no space between close-paren and bracket
    if (!x){
        cout << "x is non-zero\n";
    } //closing bracket indented to the same level as the original statement
}

It is slightly different from a class or namespace:

class myClass {}; //space between class name and bracket, otherwise the same as functions

K & R style uses such bracketing for operators, but my style uses it for everything. I would like to know if there is a name there, so I can just say that my indentation style is unexplained using such examples.

+3
source share
3 answers

Selects BSD KNF style. see http://en.wikipedia.org/wiki/Indent_style

(, , :))

+2

, ) {, .

Maulrus.

+5

Looks like a slight modification to the K & R; I do not know a single name. The potential differences in programming styles for a space-insensitive language are so great that you should expect few of them to have their own names.

0
source

Source: https://habr.com/ru/post/1739059/


All Articles