Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!uunet!munnari.oz.au!metro!cluster!necisa!boyd From: boyd@necisa.ho.necisa.oz (Boyd Roberts) Newsgroups: comp.lang.c Subject: Re: Trouble with curses Message-ID: <1903@necisa.ho.necisa.oz> Date: 29 Oct 90 23:13:38 GMT References: <173826@<1990Oct27> <20900012@inmet> Organization: NEC Information Systems Australia Pty. Ltd. Lines: 23 In article <20900012@inmet> draper@inmet.inmet.com writes: > >Hi, this is Connie. I'm accessing this net with a friends account. >I have a question about the curses package. Heres the skeletal code: > > [deleted] > > switch(tolower(getch())) { > What's the bet that tolower() is a macro? And is coded to evaluate its argument _twice_? That way you get two calls to getch() instead of one. Eg: #define tolower(c) (chartab[(c)] & C_UPPER ? (c) - 'A' + 'a' : (c)) You've got to watch those macros when their arguments have side affects. Boyd Roberts boyd@necisa.ho.necisa.oz.au ``When the going gets wierd, the weird turn pro...''