Bug or Feature: unsigned integer overflow

berni44 dlang at d-ecke.de
Sat Dec 14 07:44:37 UTC 2019


On Saturday, 14 December 2019 at 07:09:30 UTC, Tobias Pankrath 
wrote:
> void main()
> {
>     auto x = 9223372036854775808; // long.max + 1
> }

You need to tell, that this is an unsigned long literal, else the 
compiler treats it as an int:

void main()
{
     auto x = 9223372036854775808UL; // long.max + 1
}



More information about the Digitalmars-d-learn mailing list