how to initialize an array of typedef-ed type?

Jarrett Billingsley jarrett.billingsley at gmail.com
Fri May 1 06:29:15 PDT 2009


On Fri, May 1, 2009 at 9:15 AM, MLT <none at anone.com> wrote:
>
> typedef long location ;
> location a[] = cast(location[])[1,2,3,4] ;
>
> Seems to work.
> I was afraid of the mess that would happen if I cast (int *) to (long *) in C...
> Can I trust it? Is that the "right way" to do it?

Have you actually run it and seen what the results are?  If it works,
well, use it :)

(It does work, and that is the right way to do it.)


More information about the Digitalmars-d-learn mailing list