C++14 introduced the concept of digit separators into literals, along the lines of 3'141'592'653'589
. Now this is a great feature for readable code but I was wondering whether it allowed quotes before the numeric portion of a 0x/0b
-type literal. It seems to me that:
unsigned int topThreeBits = 0b'1110'0000;
unsigned int hexNum = 0x'dead'beef;
is more readable than the one without a leading separator:
unsigned int topThreeBits = 0b1110'0000;
unsigned int hexNum = 0xdead'beef;
because it clearly delineates the base from the digits.
Since I don't yet have a C++14 compiler, I need confirmation one way or another as to whether it allows this.
I know it doesn't make sense for un-prefixed numbers like '123'456
, especially since the parser wouldn't know if it was meant to be a char
variable or a numeric literal.
But, for prefixed literals, I can't see there's any confusion as to what the token is meant to be at the point the first '
arrives - the 0x/0b
has already dictated it's going to be a numeric literal.