Regarding the proposed Binray Literals Deprecation
Don Allen
donaldcallen at gmail.com
Tue Sep 13 19:47:43 UTC 2022
On Tuesday, 13 September 2022 at 19:21:11 UTC, Max Samukha wrote:
> On Tuesday, 13 September 2022 at 18:50:01 UTC, Walter Bright
> wrote:
>
>>
>> So have I. But I have only 1/4 as many digits to count, and
>> don't need to if there are 6 or fewer digits.
>
> Nibble is four digits.
And your point is?
One hex digit represents 4 binary digits. What Walter said is
correct.
I would also add that talking about user-friendly/unfriendly
doesn't make a lot of sense unless you state the purpose of the
literal. If I wanted to initialize an int to the number of states
in the US, no one sane would write
````
int n_us_states = 0b110010
````
If I were defining a mask to extract a field from a hardware
register, I might use a binary literal, though I personally would
use the shifting technique I described in an earlier post.
More information about the Digitalmars-d
mailing list