D at 20: Hits and Misses, and what I learned along the way Oct 19

Dennis dkorpel at gmail.com
Thu Oct 17 20:56:54 UTC 2019

On Thursday, 17 October 2019 at 20:39:41 UTC, H. S. Teoh wrote:
> Huh.  Walter says binary literal were removed from D, so how 
> come the following still compiles on git master??
> 	pragma(msg, 0b1000_1000);

I was surprised by him mentioning that as well. I'm glad it 
stayed too, since I actually use them. When encoding in utf8 a 
code point of two code units for example, I think this looks 
really clean:
buf[0] = 0b1100_0000 | (chr >> 6) & 0b01_1111;
buf[1] = 0b1000_0000 | (chr >> 0) & 0b11_1111;

More information about the Digitalmars-d-announce mailing list