4 ms·
It's a shame the C/C++ standards committee(s) didn't just copy Verilog's base-n notation when they added the "0b" prefix. It's nice to be able to write large c
by CamperBob2 11y ago
It's a shame the C/C++ standards committee(s) didn't just copy Verilog's base-n notation when they added the "0b" prefix. It's nice to be able to write large constants with optional underscores every four or eight digits, e.g. 32'hffff_0867_5309_beef, or 12'b1101_1110_1010.
- Someone 11y agoYou can write 1'000'000 for a million in C++14. http://en.cppreference.com/w/cpp/language/integer_literal http://en.cppreference.com/w/cpp/language/integer_literal. They didn't use underscores because _100_000 is a valid identifier in C/C++. Arbitrary bases aren't there.
- CamperBob2 11y agoNeat, I didn't know they'd done something similar with single quotes. (No law said they had to allow constants to start with an underscore, of course...)