Re:54-line if condition in gcc's reload.c
by mkl on Wednesday July 02, 2014 @01:40AM
(#7975417)
I used to use the latter, in both code and maths, but I have switched to the former. My main reason is that having the operators (logical and otherwise) at the start of the line means they're more likely to be in the same horizontal position, so it's easier to see which lines are continuations of the previous ones.
[ Parent
| on HN ]
Re:54-line if condition in gcc's reload.c
by drglitch on Wednesday July 02, 2014 @04:26AM
(#7975788)
It is also easier to comment out lines of code if you need to test something.
This is especially useful in SQL, where you can quickly -- a condition or a column, without editing commas etc on other lines, eg
SELECT
some_col
, another_col
--, and_another
, and_more
FROM blah
EDIT: too bad formatting is screwed up :/Isn't this behaviour exactly the same as with commas at the end? Here, to comment out the first line you would need to edit the second. With commas at the end, to comment out the last line you would need to edit the second last. Other than that, no editing of other lines is required.
In fact, in a language like Javascript where extra trailing commas are allowed, it seems that this argument makes even more sense for commas at the end than it does for commas at the beginning. Then, there would never be a situation where you would have to edit a line besides the one you were commenting out.
Re:54-line if condition in gcc's reload.c
by klibertp on Wednesday July 02, 2014 @09:12AM
(#7976733)
Trailing comma in SQL is a syntax error. It's also not allowed in JSON. And editing second last line can be a pain if you're testing something and are commenting/uncommenting the last line repeatedly.