Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] What does this C99 notation mean?
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2011-02-14 08:20:55


On Feb 14, 2011, at 8:14 AM, Jeff Squyres wrote:

>>> static void
>>> hwloc_setup_groups_from_distances(struct hwloc_topology *topology,
>>> unsigned nbobjs,
>>> struct hwloc_obj **objs,
>>> float *_distances)
>>> {
>>> float (*distances)[nbobjs][nbobjs] = (float (*)[nbobjs][nbobjs])_distances;
>
> Does it silently make a (temporary) 2nd array of pointers for the 2nd dimension indexing, or does the compiler translate all distances[i][j] to _distances[i*nbojbs + j] ?

Let me re-phrase that, because the way I phrased it, I could guess that that detail might be implementation-dependent.

What I meant was: _distances is clearly a 1D array. Does the above C99 notation say "treat this 1D array like a 2D array of size [x][y]"? And then how it actually happens underneath is implementation dependent (e.g., whether it makes a silent/temporary array or pointers, or converts indexing)?

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/