Hacker News new | past | comments | ask | show | jobs | submit login

I added 0b binary literals to C++ back in the 1980s.

https://www.digitalmars.com/ctg/ctgLanguageImplementation.ht...




I 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.)


As 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: