Hex constant method starts from ".a": 0xCCCCCC.argb
Виталий Фадеев
vital.fadeev at gmail.com
Mon Dec 14 05:51:28 UTC 2020
On Monday, 14 December 2020 at 05:37:21 UTC, Paul Backus wrote:
> On Monday, 14 December 2020 at 05:27:40 UTC, Виталий Фадеев
> wrote:
>> ".rgb" Compiled fine.
>> ".argb" Compilation error.
>>
>>
>> Source:
>> https://run.dlang.io/is/ULQ4kh
>
> It's parsing the `.a` in `.argb` as part of the number:
>
> auto color = 0x00AABBCC.a rgb; // what the compiler sees
>
> You can fix it with parentheses:
>
> auto color = (0x00AABBCC).argb;
Thanks!
It is not perfect, but also beauty!
More information about the Digitalmars-d-learn
mailing list