www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/18/19:13:32.3

Sender: nate AT cartsys DOT com
Message-ID: <367AEA3A.31703F2B@cartsys.com>
Date: Fri, 18 Dec 1998 15:50:18 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Allegro keypressed() always returning False
References: <3678fb52 DOT 0 AT mercury DOT nildram DOT co DOT uk> <75avcd$9jd$1 AT news1 DOT bu DOT edu> <367a1808 DOT 0 AT mercury DOT nildram DOT co DOT uk>
Reply-To: djgpp AT delorie DOT com

Graeme Fenwick wrote:
> 
> Scott Lanning wrote in message <75avcd$9jd$1 AT news1 DOT bu DOT edu>...
> >Graeme Fenwick (gfenwick AT BYESPAMprimex DOT co DOT uk) wrote:
> >:Allegro's keypressed() [...] seems to be returning false, regardless
> >: int detect_key(void) {
> >:    if (!keypressed()); <--.
> >:       return NO_KEY;      |
> 
> Umm.... *Bangs head against wall repeatedley*.
> 
> I'm not normally that stupid. Really. ;-)
> I guess I was so absorbed with trying to work out what was wrong with the
> function call/ expression in the brackets that I didn't notice the typo.
> (Since it wasn't in the original handwritten listing, I can get away with
> calling it a typo. Well, that's my excuse, and I'm sticking to it :-)   ).
> 
> Seriously... thanks to everyone who spotted that. Sometimes it needs a fresh
> eye to spot an obvious error that's been overlooked, like that one.

I've found that a really good way to avoid such errors is with Emacs'
indentation engine.  For your example, it would have indented `if...'
and `return...' the same.  At first, I always think there's a bug in the
indenter, then I look at my code and find it's wrong.  It really helps
when you're so sure of what you wrote that you can't see errors.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019