I'm used to write code (in C, Perl, or any language with curly brackets) like:
Loops:
for (int i = 0; i < 10; i++) { // <-----
...
}
Conditions:
if (i == 10) { // <-----
...
}
Main:
int main () { // <-----
...
}
Wherein I place the opening curly bracket right after the closing parenthesis. Yet, I see some templates (like in MSVC++):
int main ()
{ // <-----
...
}
Wherein the opening curly bracket is placed below.
I know that this doesn't affect the code on compilation, but I would like to ask this for code readability and for code documentation. What should I follow? The one I'm used to? Or the one compilers suggests? I would like to know which one is better.
Bonus Question: How about the space between the function name and the opening parenthesis? Should there be a space?
int main()
or int main ()
?
Thank you.