top | item 30594087

(no title)

thrwyexecbrain | 4 years ago

The sizeof(variant) example is wrong. An extra byte is needed to store the discriminator value, which in practice results in 8 extra bytes for these particular types because of alignment. https://godbolt.org/z/vno3v9rPK

The tuple drawing is also somewhat misleading, because the first box (int) should be the same size as the second one (double), due to alignment.

discuss

order

hackingcpp|4 years ago

You are right. That was probably dumbed down too much. I'll fix it.