November 3rd, 2004

sleepy

oh for the love of all that's holy

Remember my rant about why -Wall -Werror sucks? How I basically never make the mistakes they check for, and when I do, it's not really a mistake?

Well there's one mistake that's an exception to that. There's one mistake that I make, not *frequently* mind you, but at least not *rarely*. Comparison between signed and unsigned.

See, if you compare a signed variable with the value -1, and an unsigned variable with the value, say, 4, you'll get the weird result that -1 is greater than 4. Why? Because for some reason I've never understood, it doesn't compare it *sensibly*, but instead casts them both to unsigned - and -1, turned into an unsigned variable, is usually around 4.2 billion.

And STL containers - for *another* not-particularly-good reason - generally have the "size" members return unsigned ints.

Which is all acceptable when you're using a compiler that warns you about this. (Or when you can hack the headers to change this behavior, and, to be entirely honest here, I'm seriously thinking about doing that whenever I can.) And this is one of the few warnings that I wouldn't mind being an error.

Which is what -Wall -Werror does.

Or it would if GCC ACTUALLY BOTHERED WARNING YOU ON THAT PARTICULAR MISTAKE

GRRRRRR HULK SMASH

So basically, I just spent half an hour tracking down a bug, because the ONE useful thing that a feature I hate does . . . it doesn't do.

I'm going to go kill something now.
  • Current Mood
    aggravated aggravated