So my understanding is that the C99 standard mandates that pointers to different types should not be aliased (i.e. pointed to the same memory). The restrict keyword assures the compiler that two certain variables (of the same type?) are not located in the same memory slot.
Therefore, is it true, that the following function would not profit form the restrict keyword?
void sphere_intersect(float* t, const sphere* s, const ray* r);
But, a function like this would:
void vector_add(vector* v, const vector* u);
A function like
could benefit from adding restrict if the types
sphereand/orraycontain anyfloatfields. Absentrestrict, the compiler must assume thattmight alias with anyfloatfield in the objects pointed at bysorr. So any write to*tmight modify such a field meaning that the compiler could not hold the value of said field in a register for later reuse, but would instead have to reload it.