On 8/16/16 7:23 PM, Charles Hixson via Digitalmars-d wrote:
On 08/16/2016 01:49 PM, Steven Schveighoffer via Digitalmars-d wrote:
On 8/16/16 4:11 PM, Yuxuan Shui wrote:
Wait, doesn't D have strict aliasing rules? ubyte* (&evil) should not be
allowed to alias with ubyte** (&arr.ptr).

Even if it did, I believe the wildcard is ubyte*. Just like in C,
char* can point at anything, ubyte is D's equivalent.

I think what you say is true (look at the code of std.outbuffer), but
IIRC the documentation says that's supposed to be the job of void*.

void * is almost useless. In D you can assign a void[] from another void[], but other than that, there's no way to write the memory or read it.

In C, void * is also allowed to alias any other pointer. But char * is also allowed to provide arbitrary byte reading/writing.

I'd expect that D also would provide a similar option.

-Steve

Reply via email to