c++11 enum syntax ok in DMD headers ?
ibuclaw at gdcproject.org
Sat Nov 23 14:09:45 UTC 2019
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, 23 November 2019 13:54, S.G via D.gnu <d.gnu at puremagic.com> wrote:
> Thanks for the quick replying, even if a bit disapointing.
> The reason why I asked is because I'd like to avoid cases where
> the enum type is used directly and that creates an alignment
> issue that implies memory overhead, i.e
> enum SomeEnumeratedType // could be `ubyte` or `unsigned char`
> member1, member2, member3
> class Stuff
> ubyte allTheOtherMembers; //let's say
> SomeEnumeratedType someEnumeratedType // now a Stuff instance
> takes 16 bytes
> // because
> SomeEnumeratedType takes 4 bytes...
Understood, however for AST data structures in the D language frontend, I don't think such field packing would really make any valuable difference on memory. If the fields are arranged to not have a needless amount of alignment holes in the middle, such as:
// <-- up to 7 bytes padding inserted here.
// <-- up to 6 bytes padding inserted here.
Then the best improvements one can make would be in relation to memory consumption is either better GC management or add more scope destruction (in my opinion).
More information about the D.gnu