discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keyboard selection


From: Richard Frith-Macdonald
Subject: Re: keyboard selection
Date: Thu, 23 Aug 2007 10:45:40 +0100


On 22 Aug 2007, at 20:12, Graham J Lee wrote:

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.

That's a good idea.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]