Authors: Jay Ghiron
Date: 2026-05-26
Submitted against: C23
Status: Open
Some operators (the unary operator
~, and the binary operators<<,>>,&,^, and|, collectively described as bitwise operators) are required to have operands that have integer type. These operators yield values that depend on the internal representations of integers, and have implementation-defined and undefined aspects for signed types.
(C23 6.5.1 "General" paragraph 4.)
This paragraph appears to be a holdover from when ones' complement and sign magnitude were valid integer representations. Before C23 the representations of negative values could be different which led to implementation-defined results from bitwise operators, and attempting to generate negative zero from bitwise operators would lead to undefined behavior if it was not supported. Since the representation is strictly defined and negative zero cannot exist, these issues cannot exist anymore. Before C23 it was also valid for a two's complement representation to not support all value bits as zero with a sign bit of one (the minimum value when supported), which presumably would cause undefined behavior when attempting to form such a value. That possibility has similarly been removed.
Delete C23 6.5.1 paragraph 4.
Modify C23 J.3.6 paragraph 1:
The results of
some bitwise operationsright-shifts on negative signed integers, including right-shifts of zero (6.5.18).