Mail Archives: djgpp/1998/12/18/19:13:32.3
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 -