Structs can't be zero bytes in size?

Walter Bright newshound2 at digitalmars.com
Mon Sep 2 22:51:35 PDT 2013


On 9/2/2013 9:39 PM, Dylan Knutson wrote:
> On Tuesday, 3 September 2013 at 04:33:16 UTC, Walter Bright wrote:
>> 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.
>
> Fair enough. Was there any discussion on these forums about it? It sounds like
> an interesting topic of discussion, because I'm curious what the use cases are
> in D.
>
> Not to start a debate on it, but what compatibility with C is D is afforded by
> not having zero sized structs? It seems like D has abandoned a fair number of C
> warts, so it seems odd that this (to me, obscure one) one would stay.

Not following this aspect of C would result in silent and unexpected changes in 
behavior when interfacing D to C data structures, which D is supposed to be very 
good at.


More information about the Digitalmars-d mailing list