Patterns of Bugs

Iain Buclaw ibuclaw at ubuntu.com
Sat Jan 8 06:13:09 PST 2011


== Quote from Lutger Blijdestijn (lutger.blijdestijn at gmail.com)'s article
> Walter Bright wrote:
> > Jonathan M Davis wrote:
> >> On and Off would be much better, but I suspect that it's one of those
> >> things where they chose symbols instead so that they didn't have to worry
> >> about internationalization. That way, it confuses _everyone_ instead of
> >> just non- English speakers. ;)
> >
> > I suspect as much, too, but at least "on" and "off" can be looked up in a
> > dictionary. There's no hope for O and |.
> I always assumed they meant 0 and 1. Then it's easy, just put it in an if()
> statement :)

On the note of if statements. One pattern of bugs I see on the odd occasion are
else statements written like this:

if (condition1)
    if (condition2)
        statement1;
    else
        statement2;


Always takes a moment or two to look again and realise it wouldn't work as
expected without the missing braces added. ;)


More information about the Digitalmars-d mailing list