Sujet : Re: Computer architects leaving Intel...
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.archDate : 07. Sep 2024, 14:38:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86o74zmvmw.fsf@linuxsc.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Brett <
ggtgp@yahoo.com> writes:
I tried using unsigned for a bunch of my data types that should
never go negative, but every time I would have to compare them
with an int somewhere and that would cause a compiler warning,
because the goal was to also remove unsafe code.
What sort of ints? How many of those were constants? In which
cases were the int values negative, and which cases non-negative?
More generally, what are the circumstances that prompted you to
compare a can-never-be-negative value to a potentially-negative
value? Are most of the comparisons relational, or are there
lots of equality/inequality?
There are easy ways to compare (without getting warnings) signed
values and unsigned values, but how a particular case should be
addressed depends on the details. Can you supply more information?