|
|
|
|
|
by foo101
2966 days ago
|
|
I don't think "Yoda notation" is good advice. How do you prevent mistakes like the following with Yoda notation? if ( level = DEBUGLEVEL )
When both sides of the equality sign are variables, the assignment will succeed. Following Yoda notation provides a false sense of security in this case.As an experienced programmer I have written if-statements so many times in life that I never ever, even by mistake, type: if (a = b)
I always type: if (a == b)
by muscle memory. It has become a second nature. Unless of course where I really mean it, like: if ((a = b) == c)
|
|
Like other people are saying - the toolchain should have caught this. And it should have, I don't remember how it'd been disabled...