[LLVMdev] struct with signed bitfield (PR17827)
Duncan P. N. Exon Smith
dexonsmith at apple.com
Sat Nov 16 13:55:25 PST 2013
On 2013 Nov 15, at 19:41, Mark Lacey <mark.lacey at apple.com> wrote:
> I don’t have the C/C++ standards in front of me but IIRC whether a char/short/int/long/long long bitfield is signed or unsigned is implementation defined. You need to explicitly specify signed or unsigned in order to have any guarantee of the signedness, e.g. signed int.
Section 3.9.1 of the C++11 standard [1] defines short/int/long/long long as signed. Bit-fields are discussed in 9.6 and have lots of implementation-defined behavior, but I don’t see anything about signedness. The ABI (e.g., [2]) defines whether char is signed or unsigned.
[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3485.pdf
[2]: http://www.cs.tufts.edu/comp/40/readings/amd64-abi.pdf
More information about the llvm-dev
mailing list