On Monday, 28 April 2014 at 09:36:08 UTC, Andrey wrote:
not a bug.
b.f[10] is indexing the pointer to the array, not the array
itself.
b.f[0][10] is indexing the array (with the 10), but I would
argue it is better to write *(b.f)[10] so as to be clear that
f is not an array.
thank you, John.
compiler said that '*(b.f)[10]' is deprecated, and I should
write like this
void foo()
{
Type3 b;
Type1 d;
d = *(b.f[10]).ptr;
}
struct T
{
int[10]* f;
}
void main()
{
int[10] test;
T t = T(&test);
T* b = &t;
auto d = (*(b.f))[4]; //ugly but clear.
d = b.f[0][4]; //prettier but less clear.
}
note the extra brackets on the ugly one, I forgot them before.