[Issue 3150] cast from dynamic array to ulong is allowed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 10 04:28:17 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3150



--- Comment #5 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-05-10 04:28:16 PDT ---
Look at this part of the code, which actually writes the void[]:

auto r = _d_newarrayT(ti, dim); // r is of type ulong
p = *cast(void[]*)(&r);

This is inside the foo inner function (comment added by me).

Care must be taken not to set the individual parts of the array because you can
trigger runtime calls.

I'm not saying that this means casting to/from ulong is the best solution, I'm
just trying to explain why an actual D array may not be the most suitable type
to use internally.

I'm unsure why the foo function uses arrays internally, it clearly takes great
pains not to trigger any runtime calls by using casting and the ptr member.  I
don't see why it can't do this with the Array struct type instead.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list