C++ Template is inconsistent


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) {



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


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:


Got it. I guess this can be closed now.


who gave you my code?