its something i've been doing lately. It feels pretty clean & it saves a lot of vertical space which is nice but is also feels a bit taboo.It becomes slighly niggerlicious when you have many statements in the body like if(x){++x; y = 3; if(x%2) coninue; break;} but i still think its elegant-ish and if it isn't then you can always break it up into multiple lines at that point.Also since im making a whole thread feel free to post other taboo coding styles that are actually nice.
if(x){++x; y = 3; if(x%2) coninue; break;}
>>107703965>pretty clean>that are actually nice.shit taste
>>107703965Single line conditionals is forgivable, no spaces after if and while isn't.
>>107703965yeah I do this. I always put braces though. helps when I occasionally end up having to add lines to the branch
as long as it compiles and has some comments i do not fucking care
>>107703965I use it sometimes, but I have a strict rule: only if the body is 1 (ONE) statement. Avoids wasting 2 or 3 lines (depending on brace style) for 1-statement functions.On anything longer, having a newline separating statements feels cleaner and also the overhead of a couple of lines allocated to braces is no longer significant
shit taste and shit code. if (foo) DoFoo();if (bar) DoBar();while (!elements.empty()) { sum += elements.front(); elements.pop();}while (sum) if (sum % 2) print(sum);if (baz) if (sum > 30) print(print);
if (foo) DoFoo();if (bar) DoBar();while (!elements.empty()) { sum += elements.front(); elements.pop();}while (sum) if (sum % 2) print(sum);if (baz) if (sum > 30) print(print);