Universal Construction Syntax for Pointers?

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 14 03:34:02 PDT 2014


On Saturday, 14 June 2014 at 08:09:12 UTC, Philippe Sigaud via 
Digitalmars-d-learn wrote:
> Would
>
> auto i = (int*)(3);
>
> make sense?
>
> Does it work?

No:
Error: C style cast illegal, use cast(int*)3

And I don't think it should, because the heap allocation that 
you're probably expecting should be explicit IMO. For me it's 
also unintuitive, because I would read it as constructing a 
pointer that points to the address 3.


More information about the Digitalmars-d-learn mailing list