Sometimes I see code like this on Stackoverflow:
int main()
{
if(true){
return 0;
}
else{
return 1;
}
while(true){return -1;}
}
I will usually suggest this edit:
int main()
{
if(true){
return 0;
}
else{
return 1;
}
while(true){return -1;}
}
I feel like not using spaces before and after brackets is OP's style, and should be respected. Indention however should be mandatory.
My edit was followed by another edit from a user:
int main()
{
if(true)
{
return 0;
}
else {
return 1;
}
while(true) { return -1; }
}
Should I've done this in the first place? I find it more readable the latter way, but OP may not be happy about it.
Of course it is nitpicking what I do now, but what about if the post is edited again in this way:
int main( ) {
if( true ) {
return 0;
} else {
return 1;
}
while( true ) {
return -1;
}
}
Is this tolerable? My question is: should the formatting style be mimicked when editing posts? If so, what parts should be mimicked?