Tuple DIP

Timothee Cour thelastmammoth at gmail.com
Sun Jan 14 18:41:25 UTC 2018


On Sun, Jan 14, 2018 at 10:17 AM, Timon Gehr via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 14.01.2018 19:14, Timothee Cour wrote:
>>
>> actually I just learned that indeed sizeof(typeof(tuple()))=1, but why
>> is that? (at least for std.typecons.tuple)
>> maybe worth mentioning that in the DIP (with rationale)
>
>
> It's inherited from C, where all struct instances have size at least 1.
> (Such that each of them has a distinct address.)

Should definitely be mentioned in the DIP to open that up for discussion;
it breaks assumptions like sizeof(Tuple)=sum_i : tuple (sizeof(Ti));
even if that were the case in std.typecons.tuple, having it as builtin
could behave differently.


More information about the Digitalmars-d mailing list