c++ - How to check for equals? (0 == i) or (i == 0) -
okay, know following 2 lines equivalent -
(0 == i)
(i == 0)
also, first method encouraged in past because have allowed compiler give error message if accidentally used '=' instead of '=='.
my question - in today's generation of pretty slick ide's , intelligent compilers, still recommend first method?
in particular, question popped mind when saw following code -
if(dialogresult.ok == messagebox.show("message")) ...
in opinion, never recommend above. second opinions?
i prefer second one, (i == 0), because feel more natural when reading it. ask people, "are 21 or older?", not, "is 21 less or equal age?"
Comments
Post a Comment