C++ Template is inconsistent


#1

The default C++ template puts the brace on the next line for the declaration of the main function:
int main()
{

}

However, any additional logic inlines the brace:

while(1) {

}


#2

That’s not inconsistent, but an accepted standard. The discussion about how to place braces is as old as languages with braces.


#3

Brace on the next line for function and brace and on the same line for others structures (loop, if …) is an existing standard.

And don’t forget that if you want, you can code like this:


#4

Got it. I guess this can be closed now.


#5

who gave you my code?