-
Notifications
You must be signed in to change notification settings - Fork 749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[basic.fundamental] rename 'range exponent' to 'width' #2638
Conversation
Jens Gustedt is working on adopting WG21's changes from wg21.link/p1236r1 into WG14's working paper, and noticed that what WG21 calls 'range exponent' has been called 'width' in the C standard. See 'integer types' in C17: The precision of an integer type is the number of bits it uses to represent values, excluding any sign and padding bits. The width of an integer type is the same but including any sign bit; thus for unsigned integer types the two values are the same, while for signed integer types the width is one greater than the precision. C++ should use the same term where it makes sense and ones already exist, as is the case here. Jens wants to get C2x to match C++20, but it seems silly to make them change terms they've used for a long time.
This looks reasonable. The confusion potential with "width of a bit-field" seems minimal. We should inform CWG about this, since we're changing a defined term. |
Something we could do to further reduce the tiny potential for confusion is define "width of an integer", and only use "width" when context makes it obvious. I'm happy to update to this as well. |
@jfbastien, my cursory look at the changes seems to indicate that we're already sufficiently unambiguous where it matters, in particular in [class.bit]. |
CWG in Kona: approved renaming "range exponent" to "width" editorially. |
Cross referencing https://cplusplus.github.io/LWG/issue2820, which would refer to the term in question. |
@jfbastien , this needs a rebase. |
Jens Gustedt is working on adopting WG21's changes from wg21.link/p1236r1 into WG14's working paper, and noticed that what WG21 calls 'range exponent' has been called 'width' in the C standard. See 'integer types' in C17:
The precision of an integer type is the number of bits it uses to represent values, excluding any sign and padding bits. The width of an integer type is the same but including any sign bit; thus for unsigned integer types the two values are the same, while for signed integer types the width is one greater than the precision.
C++ should use the same term where it makes sense and ones already exist, as is the case here. Jens wants to get C2x to match C++20, but it seems silly to make them change terms they've used for a long time.