Re: owerflowChecks - how to make it work

2017-12-27 Thread geo555
Ah, I've found where the bug is. If it's written there as r = r * x, it's compiled into r = (NI)(r * x); and it's ok. But if it's written as r *= x, it's compiled into stareq__blah-blah((&r), x); which obviously ignores that pragma. So it must have been like r *= x; in C code instead of stareq

Re: owerflowChecks - how to make it work

2017-12-27 Thread geo555
Yeah, the manual is absolutely helpless here. Now the question stays -- how to make these checks off in the example above.

Re: owerflowChecks - how to make it work

2017-12-27 Thread Varriount
>From the [compiler >manual](https://nim-lang.org/docs/nimc.html#compiler-usage-command-line-switches): \--overflowChecks:on|off \- turn int over-/underflow checks on|off

owerflowChecks - how to make it work

2017-12-27 Thread geo555
When I run this program in a usual way (nim c -r), it stops with overflow error. How can I switch this check inside? I tried what I could find in doc/sources, but it does not seem to work. {.push overflowChecks: off.} proc `^`(x,y:int):int = (var r=1;for i in 1..y:r*=x;r)