slang icon indicating copy to clipboard operation
slang copied to clipboard

MSVC style bitfields

Open expipiplus1 opened this issue 11 months ago • 1 comments

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.

expipiplus1 avatar Feb 29 '24 16:02 expipiplus1

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.

csyonghe avatar Feb 29 '24 16:02 csyonghe

@expipiplus1 let's pause this low priority issue. Pushing to Q4

bmillsNV avatar Jul 25 '24 19:07 bmillsNV