|
From: | E. Weddington |
Subject: | Re: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing |
Date: | Mon, 20 Dec 2004 10:57:07 -0700 |
User-agent: | Mozilla Thunderbird 0.7.3 (Windows/20040803) |
Bob Paddock wrote:
the time when you accidently put = instead of ==, but some times it's whatIf you want to save yourself debugging time get in the habit of putting the constants on the left: while (0 == (SPSR & (1 << SPIF)) ; while ((SPSR & (1 << SPIF)) = 0) ; would be an error that some compilers say nothing about. The compiler will always barf if the constant is on the left because you can not assign a value to a constant.
GCC will give you a warning if the constant is on the right, and you accidentally use an assignment in an if statement. Try it and see.
Eric
[Prev in Thread] | Current Thread | [Next in Thread] |