Given int& arr[] = {a,b,c,8};
, what is sizeof(*arr)
?
Everywhere else, a reference is treated as being simply the thing itself, so sizeof(*arr)
should simply be sizeof(int)
. But this would make array pointer arithmetic on this array wrong (assuming that references are not the same widths is ints). To eliminate the ambiguity, it's forbidden.