[Beowulf] Stroustrup regarding multicore

Perry E. Metzger perry at piermont.com
Tue Aug 26 09:41:02 PDT 2008


"Robert G. Brown" <rgb at phy.duke.edu> writes:
> On Tue, 26 Aug 2008, Michael H. Frese wrote:
>> C is not much better.  I once worked a young computational
>> programmer for almost a week to get him to prove to himself that a C
>> source program couldn't walk through a 2-d array the hard way as
>> fast as a Fortran source program unless the stepping was coded by
>> hand. He didn't believe that a 2-d array in C is syntactically a 1-d
>> array of pointers to 1-d arrays, and the row pointers must be
>> fetched from memory!  And separate compilation of functions

As I said already, he's wrong....

> Perhaps, but don't most C programmers allocate such an array as a single
> vector and then repack the indices?

I've never seen anyone allocate "as a single vector and repack the
indices", though I'm sure that a counterexample exists in someone's
code out there somewhere. In any case, one has no need to do such a
thing.

(This is not to say that when one calls malloc, if you're calling
malloc to allocate an array, that you don't pass it a single size_t
indicating what you're looking for, but that's a different issue.)

Perry
-- 
Perry E. Metzger		perry at piermont.com



More information about the Beowulf mailing list