Structs can't be zero bytes in size?

Walter Bright newshound2 at digitalmars.com
Mon Sep 2 21:33:15 PDT 2013


On 9/2/2013 5:34 PM, 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.

There were huge debates about this back when the C standard was in development. 
I don't really want to start that up again :-), I don't remember all the pros 
and cons, suffice to say that with D's vaunted C compatibility I think it should 
behave the same way.


More information about the Digitalmars-d mailing list