Path: utzoo!attcan!uunet!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: Always use braces (was: Suggested new C loop syntax) Message-ID: <2563@ficc.uu.net> Date: 25 Dec 88 00:47:54 GMT References: <5@rsoft.UUCP> <1071@goofy.megatest.UUCP> <861@quintus.UUCP> <11037@ulysses.homer.nj.att.com> Organization: Xenix Support Lines: 20 In article <11037@ulysses.homer.nj.att.com>, cjc@ulysses.homer.nj.att.com (Chris Calabrese[mav]) writes: > /* > * assume students have not learned the ',' operator yet > */ > do { > inchar = getchar(); > } while(inchar != EOF && inchar); > return inchar; I would recommend in this instance to make the test experession: inchar != EOF && inchar != '\0' Since inchar is obviously not a boolean (it has three distinct possible values: EOF, 0, and anything else). -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. `-_-' Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net. 'U` Opinions may not represent the policies of FICC or the Xenix Support group.