Regarding the proposed Binray Literals Deprecation

IGotD- nise at nise.com
Tue Sep 13 21:05:23 UTC 2022


On Tuesday, 13 September 2022 at 20:43:44 UTC, Walter Bright 
wrote:
> On 9/13/2022 1:06 PM, Steven Schveighoffer wrote:
>> If I wanted to specify an "every third bit set" mask, in hex 
>> it would be `0x924924924...`. But in binary it is 
>> `0b100100100100...`. The second version is immediately clear 
>> what it is, whereas the first is not.
>
> Is it? How do you know it didn't overflow the int and create a 
> long? How do you know you filled up the int?
>
> It's pretty clear the hex one is a long.

It just as easy with binary literals as D supports the _ 
delimiter 0xb0100100_10010010_01001001_00100100. You can use the 
_ as you prefer. It is actually irrelevant what you think, if D 
would have been a commercial project you would have supported it 
because some customers would have demanded it. You would put a 
student on it to implement it during a weekend for a few dollars 
and movie ticket.

I can't believe this discussion. Initial motivation was to save a 
few lines of code, now the discussion more or less like what 
color of your underwear that is the best.


More information about the Digitalmars-d mailing list