OPAL_HAVE_HWLOC will always be defined to 0 or 1.
On Sep 12, 2011, at 9:46 AM, Kenneth Lloyd wrote: > According to http://gcc.gnu.org/onlinedocs/cpp/If.html > > "The `#if' directive allows you to test the value of an arithmetic > expression, rather than the mere existence of one macro." > > Is the objective to test for the existence of the macro, its value, or its > value IFF it exists? > > Ken Lloyd > > -----Original Message----- > From: devel-boun...@open-mpi.org [mailto:devel-boun...@open-mpi.org] On > Behalf Of Jeff Squyres > Sent: Monday, September 12, 2011 7:07 AM > To: Open MPI Developers > Subject: Re: [OMPI devel] RFC: make hwloc be a 1st-class citizen > > On Sep 12, 2011, at 8:51 AM, Jeff Squyres wrote: > >> *** Remember that although the opal_hwloc_topology global variable will > always be available, ##IT MAY BE NULL## on platforms where hwloc was > compiled out / not supported. Therefore, you MUST protect access to hwloc > API calls with #if OPAL_HAVE_HWLOC! See the original RFC text below. > > Oops! Ralph just reminded me that this was slightly inaccurate. > > If hwloc is not present, then the global variable opal_hwloc_topology won't > be present at all (because its corresponding hwloc type won't be available). > Hence, the example in the original RFC isn't quite right: > >>> if (NULL != opal_hwloc_topology) { >>> #if OPAL_HAVE_HWLOC >>> // ...use hwloc API, etc. >>> #endif >>> } > > This really should be: > > #if OPAL_HAVE_HWLOC > if (NULL != opal_hwloc_topology) { > // ...use hwloc API, etc. > } > #endif > > Sorry for the confusion! > > -- > Jeff Squyres > jsquy...@cisco.com > For corporate legal information go to: > http://www.cisco.com/web/about/doing_business/legal/cri/ > > > _______________________________________________ > devel mailing list > de...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/devel > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 10.0.1392 / Virus Database: 1520/3891 - Release Date: 09/11/11 > > _______________________________________________ > devel mailing list > de...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/devel -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/