<<< Date Index >>>     <<< Thread Index >>>

Re: Little code cleanup



On 03Mar2008 16:38, Thomas Roessler <roessler@xxxxxxxxxxxxxxxxxx> wrote:
| On 2008-03-03 15:32:32 +0000, Paul Walker wrote:
| > At least for myself, I'd prefer a warning free build to warnings
| > which come out just because someone might potentially,
| > hypothetically change a piece of code at some random time in the
| > indefinite future. I think a warning-free build gives us much
| > more in terms of usefulness.
| 
| > Defensive programming is all very well, but you can definitely
| > take it too far. :-)
| 
| I don't think these particular cases are taken too far.

Couldn't they be moved into assertions? Would that shut up the compiler?

After all, the expressions are not "constant expressions" like the
"if (1)" and "do...while(0)" conter examples; they're non-constant
test expressions whose values can be deduced to never be false; it's
reasonable for the compiler to point out this instance (provided one
could tell it "yes, yes, I know!")

It seems to me that you'ree embedding assertion like tests as side effects in
macros, and it would be stylisticly better to be up front and just assert
stuff, leaving the function call cleaner.
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Wind catches lily
scatt'ring petals to the wind:
segmentation fault
- Haiku Error Messages 
http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html