Is this a bug?
Andrey via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Apr 28 02:36:06 PDT 2014
> 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;
}
which looks completely weird for me...
> What is the reason you are using a pointer to a struct
> containing a pointer to a static array? It's often not
> necessary to work like that.
it is just a sample... in real code the struct contains a lot of
fields
More information about the Digitalmars-d-learn
mailing list