Structs can't be zero bytes in size?

Walter Bright newshound2 at digitalmars.com
Tue Sep 3 12:35:39 PDT 2013


On 9/2/2013 9:28 PM, Dylan Knutson 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.
>
> So, because backwards compatibility is an important consideration, what type of
> code breakage might one expect if D was to implement zero-size structs?

Some background:

http://stackoverflow.com/questions/7881487/zero-sized-struct
http://stackoverflow.com/questions/10971651/zero-size-struct
http://stackoverflow.com/questions/755305/empty-structure-in-c
http://connect.microsoft.com/VisualStudio/feedback/details/355187/marshal-sizeof-returns-wrong-struct-size-for-empty-struct
https://mail.elegosoft.com/pipermail/m3devel/2012-October/010196.html


More information about the Digitalmars-d mailing list