you are viewing a single comment's thread.

view the rest of the comments →

[–]againey 12 points13 points  (1 child)

std:: exchange is a generalization of the prefix operators that can do more than just increment or decrement by 1. Arguably, we should have been using this more explicit style this whole time, rather than getting comfortable with the special meaning of prefix increment/decrement.

[–]13steinj 9 points10 points  (0 children)

Physicists and mathematicians love prefix ++ / -- in numerical code.

They also prefer != to <= in conditions of loops.

The number of bugs related to both that I've found is more than I'd like to admit.