fir said:
additional question:
would it be possible to allow spaces in numbers
9between decimal digits) with no downsides?
(i do not like to write int tab[100000]
and would prefer to write tab[100 000] and
so on)
seem that could be done with not affecting
anything else, but i am not sure
I can't think of any problems off the top of my head, but I suspect
that if I spent some time on it I could come up with a contrived
but valid program that this change would break. I suppose it could
be handled similarly to string literal concatenation, which is done
in translation phase 6 -- but that would mean you can't use spaces
in integer literals in preprocessing directives, which are executed
in phase 4.
But there's ample precedent in other languages for allowing
underscores in integer literals, and I'd like to see that added
to C. (Maybe binary literals, 0b1100_1001, could be added at the
same time).
You'd have to define some rules for exactly where underscores can
be inserted. I'd allow them in both integer and floating-point
literals, but only between consecutive digits. I'm not sure
whether they should be allowed between digits in an exponent
(1.2e3_4); if your exponents are long enough that underscores make
them more readable, you're dealing with some really really big or
small numbers.
One corner case to consider: does allowing underscores only between
consecutive digits mean that 0x_12 (hex) is forbidden, but 0_12
(octal) is allowed? The leading 0 is more of a syntactic marker
than a digit. Come to think of it, a leading 0_ might have been
a better syntax for octal constants than just a leading 0.
Unfortunately, I think underscores in literals would conflict with
user-defined literals, a new feature in C++11. 123_456 already
has a meaning in C++11; it's equivalent to the function call
operator"_456"("123").