10 ms·
You can use ' as the digit separator, like: 0b00110100'10110101'10110111'01011110 It's not ideal, but using underscores was off the table, because things
by alexhutcheson 7y ago
You can use ' as the digit separator, like:
0b00110100'10110101'10110111'01011110
It's not ideal, but using underscores was off the table, because things like _100_ are actually valid variable names and it would have caused parsing issues.
- CamperBob2 7y agoThat's cool, I didn't know they supported that. Good enough! Of course, it's not as if '0' wouldn't be ambiguous, so I don't really buy the underscore-as-variable-name argument. C++ left context-free grammar behind a long time ago...
- WalterBright 7y ago_100_ is an identifier in D, too. The simple rule is _ can be embedded in a numeric literal, it just cannot start one.
- alexhutcheson 7y agoActually I got this wrong - the ambiguity occurs with C++11 user-defined literals, not with variable names. See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2747.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n274...