Hi all, a topic to shoot the breeze. The topic is about the form (looks) of your code.
In the beginning of my short c++ career, I was a fan of the following looks:
1 2 3 4 5
for(int i=0;i<10;i++)
{
int n= MyFavouriteFunction(i);
cout<<n;
}
However, I discovered that sometimes I want to do functions that are very long (2-3 screens), so I needed to decrease the spacing of my code. So, lately, I am using the following format:
1 2 3 4
for(int i=0;i<10;i++)
{ int n= MyFavouriteFunction(i);
cout<<n;
}
Which looks do you use for your code? Also your comments on spacing with space bars and/or tabs?
My formatting is always indented with 2 spaces, replacing all tabs.
My statements are formatted like:
1 2 3 4 5
if (something == true) {
// then do something
} else {
// do something else
}
I don't like your first style becase it increases the amount of lines you require to write any statement. Your second style seems hard to read to me also.