Description
This is likely a 2.x feature.
I would like to be able to use underscores inside number literals to break up long runs of digits.
For example 1000000000
is harder to understand than 1_000_000_000
.
Today I saw x & 0x3FFFFFF
with a comment saying the result fits in 30 bits.
If you count the F
s, you will see there is an error, but the error has gone unnoticed for several years.
If underscores were permitted, the following difference might be more apparent to the developer or reviewer:
x & 0x_3FF_FFFF vs x & 0x_3FFF_FFFF
I would want the exact placement of underscores not be prescribed, the same literal might warrant different structure depending on context. In some byte-oriented code 0x3F_FF_FF_FF
might make more sense.
This feature would also make binary literals (0b_1111_1111
= 255) more useful.