A strange div bug on Linux x86_64, (both dmd & ldc2): long -5000 / size_t 2 = 9223372036854773308

mw mingwu at gmail.com
Fri Aug 14 00:13:01 UTC 2020


On Friday, 14 August 2020 at 00:04:55 UTC, H. S. Teoh wrote:
> On Thu, Aug 13, 2020 at 11:54:57PM +0000, mw via Digitalmars-d 
> wrote:
>> On Thursday, 13 August 2020 at 23:47:30 UTC, Walter Bright 
>> wrote:
> [...]
>> > The thing about checkedint is there are several different 
>> > behaviors one might choose as responses to overflow. There 
>> > is no one-size-fits-all, if we did pick one we'll inevitably 
>> > have complaints.
> [...]
>> If we choose this approach, the hook can also have its own 
>> command line option to let the user in explicit full control 
>> of what the integer operation behavior s/he really wants for 
>> his/her application.
> [...]
>
> The application can just use CheckedInt instantiated with 
> whatever preferences it wants to. Define an alias to that in a 
> common module and import that, and you're good to go:
>
> 	alias Int = CheckInt!(... /* whatever settings you want here 
> */);

This doesn’t work for language buildins array.length.

>
> What we do *not* want is a compiler switch that will silently 
> change the meaning of existing code. Imagine the chaos if you 
> compiled your application with -int-behaviour=blahblah, and 
> suddenly all of your dub dependencies start misbehaving because 
> their code was written with the standard rules in mind, and

I saw that problem already, that’s why I also said :  “in 
modules, that users also specified on command-line”.

Now on a 2nd thought, on the module file level , let user specify 
at the top.






More information about the Digitalmars-d mailing list