Integer overflow and underflow semantics?

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 21 07:32:37 PDT 2014


Basile Burg:

> If you still feel ok today then dont read this:
> -----------------
> module meh;
>
> import std.stdio;
>
> //https://stackoverflow.com/questions/24676375/why-does-int-i-1024-1024-1024-1024-compile-without-error
>
> static shared immutable int o = 1024 * 1024 * 1024 * 1024;
>
> void main(string args[])
> {
>     writeln(o);
> }
> -------------------------------------------------------------

See:
https://issues.dlang.org/show_bug.cgi?id=4835
https://github.com/D-Programming-Language/dmd/pull/1803

Bye,
bearophile


More information about the Digitalmars-d mailing list