Nevil Lesdog wrote:
>
> What do you think is the best way to handle a compiler warning about
> comparing an unsinged value to a singed value? Cast to silence it?
> Disable that warning altogether? Or just live with it?
None of those. Consider whether values should be 'singed' or not.
>
> On one hand, the warning *could* be useful. Most of the time I get it in
> cases where I know the comparison is safe, but it's not hard to imagine
> that this won't always be the case. This makes disabling it undesirable.
> Casting is a workable solution, but I worry that changes in the code
> later could introduce errors that go undetected due to the cast. And I
> think we all hate not having a "clean" compile (if only because having a
> bunch of warnings that you expected makes it more difficult to spot the
> ones you didn't expect).
If a negative value ever appears in either compareee, the
comparison is NOT safe.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
--
Posted via a free Usenet account from
http://www.teranews.com