On 20 Aug 2007, at 14:39, Richard Frith-Macdonald wrote:
I also try to always write code to test 'if (x == YES)' rather
than 'if (x)', as it will fail in more cases (and hopefully cause
us to spot errors like that) if someone has done something like
assigning a bitmask to a boolean.
Not a big issue, just a bit of coding style that I've found helps
code reliability over the years.
...a more contentious style (but one I've personally adopted) is to
write that as:
if (YES == x)
for the simple reason that the PEBKAC error:
if (YES = x)
is now a compiler error, rather than a logic problem.