Not a compiler bug.

John Colvin john.loughran.colvin at gmail.com
Thu Aug 13 09:25:07 UTC 2020


On Thursday, 13 August 2020 at 08:23:30 UTC, mw wrote:
> On Thursday, 13 August 2020 at 08:07:56 UTC, John Colvin wrote:
>> The windows version is probably different because you are 
>> building a 32 bit exe and therefore size_t is uint, which will 
>> be promoted to long in the division.
>
> $ /mnt/c/project/dmd2/windows/bin64/dmd.exe --version
> DMD64 D Compiler v2.092.0-dirty
> Copyright (C) 1999-2020 by The D Language Foundation, All 
> Rights Reserved written by Walter Bright
>

compiler architecture doesn't imply generated code architecture. 
E.g. try compiling your file with -m32 or -m64 or -m32mscoff (see 
https://dlang.org/dmd-windows.html#switch-m32)

>> If you do a bit of a search on the forums you'll find this 
>> issue having come up many times before and you might find 
>> those discussions informative.
>
> Sigh, if D continue behave like this, it can hardly be called a 
> C++ improvement.

D has many differences with C/C++, many of which I would consider 
an improvement. However, it does not address all of the things 
that cause difficulty with C/C++.

Personally I would love to be able to disallow implicit 
signed-to-unsigned conversions in almost all cases, but that 
would be a big breaking change.


More information about the Digitalmars-d mailing list