Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] signed / unsigned
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2009-12-16 21:03:30


Ok, done. Please review:

    https://svn.open-mpi.org/trac/hwloc/changeset/1475

Additionally, there were a whole pile of signed/unsigned comparisons left in lstopo-draw.c that I am a bit too tired to figure out -- could you guys resolve them?

On Dec 16, 2009, at 4:58 PM, Brice Goglin wrote:

> Jeff Squyres wrote:
> > 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.
> >
>
> os_index == -1 means that it is unknown (or does not mean anything or
> whatever).
>
> > 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?
> >
>
> (unsigned) -1 is fine with me.
>
> Brice
>
> _______________________________________________
> hwloc-devel mailing list
> hwloc-devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-devel
>

-- 
Jeff Squyres
jsquyres_at_[hidden]