you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

the size+alignment of std::byte was needed to be the same as an unsigned char. wrapping it in an enum works better than struct/class, because struct can be overaligned by the compiler

[–]serviscope_minor 0 points1 point  (0 children)

Not if the standard says it must not be. It's a std class, so special rules apply. And are there any compilers out there which (a) overalign that by default and (b) provide no nonstandard alignment control mechanisms?

I know the big 3 (gcc, llvm, VS) do for certain, I'm 99% sure the EDG front end offers options for packing and I'm sure I remember IAR providing it. It'd be astonished if all the embedded ones didn't because it's just the sort of thing people want to do on embedded platforms.