3 ms·
I added 0b binary literals to C++ back in the 1980s. https://www.digitalmars.com/ctg/ctgLanguageImplementation.html#binary_constants https://www.digitalmars.co
by WalterBright 3y ago
I added 0b binary literals to C++ back in the 1980s.
https://www.digitalmars.com/ctg/ctgLanguageImplementation.html#binary_constants https://www.digitalmars.com/ctg/ctgLanguageImplementation.ht...
- notbeuller 3y agoI really appreciate the single quote allowing for alignment: case 0b0001'0000: case 0b0101'1000: (edit, fixed formatting, but I also wanted to agree with a lower down comment asking for 0b001_0000 instead; a better choice.)
- WalterBright 3y agoAs you say, in D it's: case 0b0001_0000: case 0b0101_1000: which indeed looks much nicer. I have no idea why C++, when copying the feature, didn't use _. P.S. I copied this feature from 1983 Ada. AFAIK, it was a completely forgotten feature until D had it, then other languages started copying D.