On Dec 16, 2009, at 3:35 PM, Jeff Squyres wrote: > While preparing to SVN commit, I made the default for HG checkouts to compile > with debug and picky modes. I now see a TRUCKLOAD of signed/unsigned > comparison warnings. I'll look into these right now...
A bunch of them were fairly straightforward "using int and unsigned together" cases that were easy to fix. But some of them are less clear -- comparing what should be unsigned values with -1. This makes me believe that -1 is being used as a sentinel value in some places -- e.g., in hwloc_obj_t->os_index. It's a "signed" field, but many of the comparisons that are made to it are from "unsigned" variables. And at least in one or two places, it is compared against -1. Which should be fixed -- make the .os_index field be unsigned (and either have another boolean indicating whether the .os_index value is valid or not, or having a sentinel value for invalid (perhaps ((unsigned) -1)?), or make all the comparison variables be unsigned? I've attached a patch of what I've done (on my OS X laptop). There's two main sets of changes: - change easy/obvious int's to unsigned's - changed .os_index (and 1 or 2 others) to unsigned But I don't want to commit anything because of the above issue; clearly, I've broken something because comparing .os_index to -1 won't work. -- Jeff Squyres jsquy...@cisco.com
unsigned-signed.patch
Description: Binary data