[Beowulf] Stroustrup regarding multicore
Lux, James P
james.p.lux at jpl.nasa.gov
Tue Aug 26 12:49:44 EDT 2008
From: Perry E. Metzger [mailto:perry at piermont.com]
Sent: Tuesday, August 26, 2008 9:39 AM
To: Lux, James P
Cc: Michael H. Frese; Beowulf at beowulf.org
Subject: Re: [Beowulf] Stroustrup regarding multicore
"Lux, James P" <james.p.lux at jpl.nasa.gov> writes:
> The example you give is going to be compiler dependent.
Even if it were, I defy you to find a c compiler that does
differently. As it is, this is not in fact compiler dependent.
> There's no requirement in K&R
There is, but in any case, K&R is not the controlling document, the
ANSI standard is.
I have a copy of the C99 document and it is indeed required that the
locations be consecutive (though there can of course be padding for
alignment purposes if you have an array of structures).
If you wish for me to quote chapter and verse from the document, I
> All that is guaranteed is that you can retrieve the successive
> elements of the array by successive values of the index.
No. You are actually given guarantees about memory layout. They're not
phrased as such, but they're quite rigid. (This is rather different
from the situation with, for example, pointers, where you are
explicitly not guaranteed that pointer types are interchangeable.)
We have coding standards here (JPL) for flight software (derived from MISRA to a large part), which I will readily concede is NOT generally HPC computing, that assert that one cannot depend on a particular memory layout, unless it's explicitly defined somehow.
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
More information about the Beowulf