[Beowulf] Stroustrup regarding multicore
ed at eh3.com
Tue Aug 26 11:04:46 PDT 2008
On Tue, 26 Aug 2008 12:53:11 -0400 "Perry E. Metzger" wrote:
> "Perry E. Metzger" <perry at piermont.com> writes:
> > 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.
> For the hell of it, I whipped my copy out, since I was in the mood.
> Indeed, if one looks at page 47 of Technical Corrigendum 2 of the C99
> document, one learns that:
> An array type describes a contiguously allocated nonempty set of
> objects with a particular member object type, called the element
> Note the phrase "contiguously allocated", which is a term of art in
> the document meaning precisely what you think it means.
Thank you for shining some light into this language ghetto !!!
[ And I mean that in the best possible sense. Its sad to see
some folks on this list make such simultaneously eager and
untrue pronouncements about programming languages. ]
The ISO C++ standard has similar contiguous-allocation guarantees such
as (Sec 23.2.4 of ISO/IEC 14882:2003):
A vector is a kind of sequence that supports random access
iterators. In addition, it supports (amortized) constant
time insert and erase operations at the end; insert and
erase in the middle take linear time. Storage management
is handled automatically, though hints can be given to
improve efficiency. The elements of a vector are stored
contiguously, meaning that if v is a vector<T, Allocator>
where T is some type other than bool, then it obeys the
identity &v[n] == &v + n for all 0 <= n < v.size().
And guarantees like the above make it rather easy for programmers to,
for instance, "assemble" their inputs in C++ and then, if they want,
call C, Fortran, assembly-optimized, or even GPU-/FPGA-implemented
routines to perform BLAS, (I)DFT, or other operations.
Remember, folks, languages do not have to be an "xor" choice. The "and"
operator is available to all of us.
Edward H. Hill III, PhD | ed at eh3.com | http://eh3.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: not available
Url : http://www.scyld.com/pipermail/beowulf/attachments/20080826/73963150/signature.bin
More information about the Beowulf