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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 10 04:20:41 PDT 2010


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



--- Comment #4 from Don <clugdbug at yahoo.com.au> 2010-05-10 04:20:38 PDT ---
(In reply to comment #3)
> Actually, you need a type besides a D array because you do not want to trigger
> runtime calls when setting the length.

I don't understand this comment. A D array is used internally in the function.
The function calculates a void[], and then casts this to ulong to return it.
Then, in the compiler, it grabs the ulong back into a pointer. This all happens
in the glue layer -- it's too late for any runtime calls to be added.
Have I missed something?

> There might be opitmizations that the compiler makes when forming a ulong vs.
> some arbitrary type, I'll have to investigate that.

Could be, but as far as I can tell, the dynamic array ABI is identical to ulong
(result in EDX:EAX). So the compiler could probably cast it to ulong internally
in e2ir.c, if there were any problems.

-- 
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