fat struct style guide?

Kapendev alexandroskapretsos at gmail.com
Tue Feb 24 21:42:37 UTC 2026


On Tuesday, 24 February 2026 at 21:37:44 UTC, Kapendev wrote:
> You get the same type of indirection with a "mega struct" if we 
> are talking about type checking.
> And you will be checking types often in a game.
> There is literally no difference in how a tagged union and a 
> mega struct works if you create a union with members that all 
> share the same first field.
> The only difference will be the size, with tagged unions being 
> smaller and faster to iterate over.

You can optimize both for size, but anyway. In D, it is so much 
easier to use a tagged union compared to something like C, so why 
not use it?


More information about the Digitalmars-d-learn mailing list