Pointer to pointer


Consider the next, simplified, pseudo code data structure:

struct List {

int values;


and a

List list;

The data is stored in global memory. When I retrieve list[0].values[0], is this a single call to global memory or are there 2 calls necessary?

I would guess the data at list[0] is retrieved and then values[0], resulting in two consecutive memory calls. If so, I have to make a difficult decision:

  1. store all the data in one large array and use a complex index (computational intensive) or

  2. have nice and logical datastructures (memory intensive)

lists[0] is only an addresss in the expression on list[0].values[0].

I think the compiler will generate an address and call global memory only once