Array type conversion
Manfred Nowak
svv1999 at hotmail.com
Sat Apr 28 11:42:29 PDT 2007
Mark Burnett wrote
> only one of them isn't an Apple and you have undefined behavior.
>From the specs:
| Multiple dynamic arrays can share all or parts of the array data.
With the asssignment:
justsomefruits = lotsofapples;
you did pointer assignments and thereby declared that the array data
can be interpreted as both: Fruits and Apples. The handling of this
declaration is up to your intelligence. If you fail, then you might
have tricked out yourself.
If you wanted a componentwise array copy you should have written:
justsomefruits[] = lotsofapples; // observe the []
and the compiler would have served you with appropriate error messages.
-manfred
More information about the Digitalmars-d
mailing list