Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.arch Subject: Re: Computer architects leaving Intel... Date: Sat, 07 Sep 2024 06:38:31 -0700 Organization: A noiseless patient Spider Lines: 17 Message-ID: <86o74zmvmw.fsf@linuxsc.com> References: <2024Aug30.161204@mips.complang.tuwien.ac.at> <2024Aug30.195831@mips.complang.tuwien.ac.at> <2024Aug31.170347@mips.complang.tuwien.ac.at> <505954890d8461c1f4082b1beecd453c@www.novabbs.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sat, 07 Sep 2024 15:38:33 +0200 (CEST) Injection-Info: dont-email.me; posting-host="15cdd4985ebd3d04d209b9ff3a6e4cfe"; logging-data="1472649"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kxDJzGfRlbVaayd8r0jmNw+0m7uoZSh4=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:UqcFewKsaMgmdbZR3T264LoFqSE= sha1:v179nB1HiBNvRP9VZ4VeVOGa5FQ= Bytes: 2478 Brett 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?