In one C++ coding style guide,
I found one particular recommendation (page 41, recommendation number 53):
Always have non-lvalues on the left side (0 == i
instead of i == 0
).
And I don't uderstand what is this good for? Are to sticking to this practice?
I'm not and I don't know why is his a good practice. The only advantage I can think of is that is will avoid mistaking an unintentional assignment with a comparison (if (foo = 0){}
versus if (foo == 0){}
)
Have you got any other ideas why should I use it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…