From: mschulter AT mach1 DOT mpu DOT com () Newsgroups: comp.os.msdos.djgpp Subject: Re: Laugh at my mistakes (Errors you wish you're mother told you about) Date: 2 Nov 1996 01:16:10 GMT Organization: MP Unlimited, Inc. Lines: 38 Message-ID: <55e7cq$kpc@news.mpu.com> References: <199610221957 DOT MAA26135 AT netcom8 DOT netcom DOT com> NNTP-Posting-Host: mach1.mpu.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Dave Cigna (cigna AT helios DOT phy DOT OhioU DOT Edu) wrote: : A little trick that (I never use, but seems kind of cool anyway): : if(0 = A) : : instead of : if(A = 0) : will always generate an error, even without -Wall. : -- Dave Cigna Actually that trick, which I heard from a more experienced user not so long ago, is a theme of my next C column . As I note there, the GCC warning is very helpful and descriptive, more or less: suggest parentheses around assignment used as truth value That identifies the possible mistake and nicely reinforces the distinction in question at the same time. When editing and compiling inside of Emacs 19.31, I use a makefile with the -Wall option; that makes it easy to get information on possible glitches of this kind. I'm not sure why, but the tendency to put the variable before the constant in an equality test seems very strong . Margo Schulter mschulter AT mpu DOT com MSDOG Slowly Develops Opulent GNUness