S
Szabolcs Borsanyi
I know that this topic has been discussed a lot, still I'd appreciate
a clear cut (and correct) answer:
I pass a multidimensional array to a function, which is defined as
int f(int a[10][10])
{
int *b=(void*)a;
int *c=a[0];
/*...*/
}
Now the questions come:
- Is it guaranteed that b and c points to the same object (or is this
implementation defined)?
- Is it always true that a[1][1] refers to the same object as c[11] ?
(There is no hole)
- Does dereferencing b violate any aliasing rule?
Thanks
Szabolcs
a clear cut (and correct) answer:
I pass a multidimensional array to a function, which is defined as
int f(int a[10][10])
{
int *b=(void*)a;
int *c=a[0];
/*...*/
}
Now the questions come:
- Is it guaranteed that b and c points to the same object (or is this
implementation defined)?
- Is it always true that a[1][1] refers to the same object as c[11] ?
(There is no hole)
- Does dereferencing b violate any aliasing rule?
Thanks
Szabolcs