Sitting here writing some code on a parser, so while writing a counter I needed to write something like
if ... {
...
some_list.clear();
counter++;
continue;
}
But, do you think writing it this sort of way is nicer,
...
++ counter; // With a space after operator
continue;
}
The thought was, maybe if you have some code around this, it'll stand out more... I don't know. What do you think?
Suppose I should also get some design practises book along with the other two books I am getting next week.
view the rest of the comments →
[–] scandalous-goat ago (edited ago)
I prefer
x += 1for an incrementation statement, as the intent is, IMO clearer. But I'm sure plenty would disagree with me.I didn't compare the compiler's output for all three syntax, though.
edit:
I just did a test. The compiler produces exactly the same code for all three syntaxes if they are used as a statement.
[–] skruf [S] ago
This is one of the things I think makes programming interesting, the different styles there is. The most interesting example I think of is Fox-Toolkit's style, the author has an, I may say, interesting style...