2 ms·
C++ uses apostrophes. If you want to use numbers in header files that are common to both C and C++ code, you want the syntax to be the same.
by uluyol 5y ago
C++ uses apostrophes. If you want to use numbers in header files that are common to both C and C++ code, you want the syntax to be the same.
- gavinray 5y agoWelp, yeah I'd say that's a pretty good reason. I then shift blame to whomever decided that was a good idea for C++, tossing it on the towering pile of similar questions directed towards C++'s architecture.
- jcelerier 5y agoit would conflict with user defined literals which were there before: auto operator""_01(unsigned long long l) { return 0; } int x = 100_01; // x == 0 so, as always, backward compat :D (grepping in my ~ I see at least one occurence of `operator "" _0b` and if you allow `_0b` it's going to be hard to justify not allowing `_0123456`).
- WalterBright 5y agoA leading underscore just makes it an identifier. After all, ' has a similar ambiguity - is '0' an integer or a character? We use embedded _ in D with no problems.