[Beowulf] Stroustrup regarding multicore

Perry E. Metzger perry at piermont.com
Tue Aug 26 09:38:37 PDT 2008


"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
will.

> 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.)

Perry



More information about the Beowulf mailing list