sumtype 1.0.0

Dibyendu Majumdar mobile at majumdar.org.uk
Tue Nov 24 23:02:15 UTC 2020


On Tuesday, 24 November 2020 at 22:26:34 UTC, Paul Backus wrote:

>> Nice. Is it possible to describe how these types are 
>> represented in memory? Anyone who uses unions and wants to use 
>> these would want to know whether these types are laid out like 
>> unions or not. What is the size of the type - is it equal to 
>> the largest member?
>
> SumType uses a union internally, so the types all share the 
> same memory. The size of the SumType is equal to the size of 
> the union plus the size of the tag (plus padding, if necessary).

Thanks - I was suggesting adding a description to the 
documentation, unless it is already there. Also an ABI 
specification would be helpful - what happens when a value  is 
passed to a C program.




More information about the Digitalmars-d-announce mailing list