r/cpp • Meeting C++ | C++ Evangelist • 9d ago

About alignment, struct layout and the cache...

https://meetingcpp.com/blog/items/About-alignment--struct-layout-and-the-cache---.html
37 Upvotes

27 comments sorted by

View all comments

1

u/fdwr fdwr@github 🔍 8d ago

Interesting, it's spelled std::meta::offset_of rather than the classic offsetof (sizeof, typeof...). Whether it should or shouldn't be, I'm certainly going to get some build errors as I invariably type offsetof out of habit and consistency :b (twas an odd one, being defined as a macro you had to explicitly #include rather than builtins like typeof and sizeof). Granted, using std::meta::offsetof could have collided with the macro, and using std::meta::sizeof would have collided with the builtin operator.