Skip to content
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

Merged
merged 2 commits into from Mar 15, 2019

Conversation

jfbastien
Copy link
Contributor

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.

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.
@jensmaurer
Copy link
Member

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.

@jensmaurer jensmaurer added the cwg Issue must be reviewed by CWG. label Jan 6, 2019
@jfbastien
Copy link
Contributor Author

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.

@jensmaurer
Copy link
Member

@jfbastien, my cursory look at the changes seems to indicate that we're already sufficiently unambiguous where it matters, in particular in [class.bit].

@jensmaurer
Copy link
Member

jensmaurer commented Feb 19, 2019

CWG in Kona: approved renaming "range exponent" to "width" editorially.

@jensmaurer jensmaurer removed the cwg Issue must be reviewed by CWG. label Feb 19, 2019
@hubert-reinterpretcast
Copy link
Contributor

Cross referencing https://cplusplus.github.io/LWG/issue2820, which would refer to the term in question.

@zygoloid zygoloid added the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Mar 15, 2019
@zygoloid zygoloid added this to the post-2019-02 milestone Mar 15, 2019
@jensmaurer
Copy link
Member

@jfbastien , this needs a rebase.

@jensmaurer jensmaurer removed the needs rebase The pull request needs a git rebase to resolve merge conflicts. label Mar 15, 2019
@zygoloid zygoloid merged commit 0ba5424 into cplusplus:master Mar 15, 2019
@jfbastien jfbastien deleted the range-exponent branch March 15, 2019 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants