Regarding the proposed Binray Literals Deprecation

mw mingwu at gmail.com
Sat Sep 10 14:56:55 UTC 2022


On Saturday, 10 September 2022 at 08:19:18 UTC, Max Samukha wrote:
> On Saturday, 10 September 2022 at 02:22:53 UTC, Walter Bright 
> wrote:
>
>> Hex values are far easier to read, too. Have you ever put the 
>> tip of your pencil on the screen to count the number of 1's? I 
>> have. Binary literals are user unfriendly.
>
> Bit flags are easier to read as binary grouped in nibbles. For 
> example:
>
> enum ubyte[16] ledDigits =
>     [
>         0b0011_1111, // 0
>         0b0000_0110, // 1
>         ...

Exactly! It's true that binary literals are user unfriendly *by 
itself*, but *with* separating underscores "_" it's much easier 
to use than hex values.



More information about the Digitalmars-d mailing list