Let's say I have an array:
mytype_t array[1000];
I set up a pointer into the array:
mytype_t * pointer = &array[317];
Assuming array[317] (and surrounds) are already present in CPU cache, will dereferencing the pointer have exactly the same cost as dereferencing the array by index?
Under what circumstances, if any, would the pointer approach be slower?
EDIT On request of FUZxxl &Olaf, the primary architectures under consideration are Intel desktop architectures and ARM, though others are likely in the future (gaming platforms like Sony's CBEA, IBM Broadway for Wii); compiler is GCC 5.1.0.