[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: keyboard selection
From: |
Graham J Lee |
Subject: |
Re: keyboard selection |
Date: |
Wed, 22 Aug 2007 20:12:11 +0100 |
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.
Cheers,
Graham.