Structs can't be zero bytes in size?

Piotr Szturmaj bncrbme at jadamspam.pl
Tue Sep 3 09:00:56 PDT 2013


On 03.09.2013 07:51, Walter Bright wrote:
> 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.

How about specifying extern(C) before each C structure? The majority of 
bindings already have "extern(C):" on top of module.


More information about the Digitalmars-d mailing list