[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Feature request - compiler warning for "if" stmts tha
From: |
Bob Paddock |
Subject: |
Re: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing |
Date: |
Mon, 20 Dec 2004 07:30:39 -0500 |
User-agent: |
KMail/1.7.1 |
On Monday 13 December 2004 05:06 pm, Curtis Maloney wrote:
> > while ((SPSR & (1 << SPIF)) == 0)
> > ;
Lint can be made to not complain about that because it is a common use,
but it will still complain about:
while ((SPSR & (1 << SPIF)) == 0);
> I'd rather have a few warnings on things I know are ok _this time_,
Warnings are *ALWAYS* bad. Think of the next guy that has to work on the
code, he is not going to know which warnings are 'ok' and which are real.
Leaving warnings in code leads to complacency in ignoring warnings,
not a road to start down.
> the time when you accidently put = instead of ==, but some times it's what
If 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.
--
http://www.softwaresafety.net/
http://www.unusualresearch.com/ http://www.bpaddock.com/
- RE: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing, Dave Hylands, 2004/12/13
- RE: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing, Douglas Dotson, 2004/12/13
- Re: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing, rusty+avr-gcc-list, 2004/12/13
- Re: [avr-gcc-list] Feature request - compiler warning for "if" stmts that do nothing, Douglas Dotson, 2004/12/13
- Re: [avr-gcc-list] Feature request - compiler warning for "if" stmtsthat do nothing, Dave Hansen, 2004/12/14
- Re: [avr-gcc-list] Feature request - compiler warning for "if" stmtsthat do nothing, Douglas Dotson, 2004/12/14
- Re: [avr-gcc-list] Feature request - compiler warning for "if"stmtsthat do nothing, Graham Davies, 2004/12/14
- Re: [avr-gcc-list] Feature request - compiler warning for "if" stmtsthat do nothing, Dave Hansen, 2004/12/14