The article mentions:
Restricted pointers can be copied from one to another to create a hierarchy of pointers.
However there is one limitation defined in the C99 standard.
The child pointer must not be in the same block-level scope as the parent pointer.
The result of copying restricted pointers in the same block-level scope is undefined.
And then it provides an example:
{
vector3* restrict position = &obj_a->position;
float* restrict position_x = &position->x; <-- UNDEFINED
{
float* restrict position_y = &position->y; <-- VALID
}
}
Tho, later on, it has another example:
void
move( vector3* restrict velocity,
vector3* restrict position,
vector3* restrict acceleration,
float time_step,
size_t count,
size_t stride )
{
float* restrict acceleration_x = &acceleration->x;
float* restrict velocity_x = &velocity->x;
float* restrict position_x = &position->x;
I thought now the restricted parent pointer position
is in the same scope as its child pointer position_x
, no?