Structs can't be zero bytes in size?

Lionello Lunesu lionello at lunesu.remove.com
Mon Sep 2 19:31:53 PDT 2013


On 9/3/13 8:34, Vladimir Panteleev wrote:
> On Tuesday, 3 September 2013 at 00:05:04 UTC, Walter Bright wrote:
>> On 9/2/2013 4:57 PM, Dylan Knutson wrote:
>>> Can someone shed some light on this?
>>
>> It comes from C. This was done in C so that addresses of struct
>> instances will always be unique.
>
> Why is that important, and why does D need it?
>
> In C, this might make some sense, however empty structs are much more
> useful in D, e.g. for metaprogramming.

struct Z {};
Z a, b;
assert(&a != &b);


More information about the Digitalmars-d mailing list