slang
slang copied to clipboard
MSVC style bitfields
The current bitfield implementation is consistent with how GCC/Clang does things, but as noted here and here MSVC packs in the opposite order with different behavior when the member types have different sizes.
FWIW, how to specify bit fields is not specified for C or C++
We could add an option to support this behavior. Changes would be necessary in SemanticsDeclAttributesVisitor::visitStructDecl(StructDecl* structDecl)
.
Implemented either as a compiler option or as an attribute on the containing struct.
In addition to the ordering difference, msvc starts a new field whenever the next field's type has different size the the currently open slot's type.
@expipiplus1 let's pause this low priority issue. Pushing to Q4