Regarding the proposed Binray Literals Deprecation

Walter Bright newshound2 at digitalmars.com
Sat Sep 10 17:57:28 UTC 2022


On 9/10/2022 12:03 AM, Daniel N wrote:
> This has an obvious visual meaning but in hex it would be hard to read.
> 0b111111
> 0b100001
> 0b100001
> 0b111111

That was the original motivation back in the 80s. But I've since realized that 
this works much better:

   XXXXXX
   X....X
   X....X
   XXXXXX

Wrap it in a string literal, and write a simple parser to translate it binary data.

Like what I did here:

https://github.com/dlang/dmd/blob/master/compiler/src/dmd/backend/disasm86.d#L3645

which makes it really easy to add test cases to the disassembler. Well worth the 
extra effort to make a tiny parser for it.


More information about the Digitalmars-d mailing list