On Fri, November 29, 2013 11:00, Klaus Hartnegg wrote:
> On 28.11.2013 18:32, Tomas Hajny wrote:
>> On Thu, November 28, 2013 18:12, Klaus Hartnegg wrote:
>>> Sorry, I forgot to mention there is {$Q-} in the source.
>>
>> I believe that $Q- covers overflow checks, not range checks.
>
> Thanks, this
On 29 Nov 2013, at 11:00, Klaus Hartnegg wrote:
Explanation: I'm trying to port code from Turbo Pascal. There word1-
word2 does wrap around with {$Q-}{$R+}. And dec(word1) never checks
for overflow, even with {$Q+}{$R+}.
FreePascal seems to have a wider definition of Range Check, and the
On 28.11.2013 18:32, Tomas Hajny wrote:
On Thu, November 28, 2013 18:12, Klaus Hartnegg wrote:
Sorry, I forgot to mention there is {$Q-} in the source.
I believe that $Q- covers overflow checks, not range checks.
Thanks, this showed me the right direction.
Explanation: I'm trying to port co
Am 28.11.2013 18:33 schrieb "Tomas Hajny" :
> > This looks like a missing declaration of one variant of the dec
function.
Aside from what Tomas said: there us no declaration of Dec(), because it is
a compiler intrinsic and thus directly converted by the compiler into code.
Regards,
Sven
_
On Thu, November 28, 2013 18:12, Klaus Hartnegg wrote:
> Sorry, I forgot to mention there is {$Q-} in the source.
I believe that $Q- covers overflow checks, not range checks.
> The trick was indeed to use dec(longint(a),b). However I had missed one
> place in the code, so I got another runtime e
Klaus Hartnegg wrote:
Hi,
How can I subtract two longwords such that when the result becomes
negative, it rolls over?
A := A - B triggers runtime error 201 when the result is negative.
dec (A,B) rolls over, but triggers runtime error 201 when A is higher
than the highest possible value of l
Sorry, I forgot to mention there is {$Q-} in the source.
The trick was indeed to use dec(longint(a),b). However I had missed one
place in the code, so I got another runtime error from there.
But why does it only work with longint, and not with longword?
This looks like a missing declaration o
On Thu, November 28, 2013 17:37, Klaus Hartnegg wrote:
Hi,
> How can I subtract two longwords such that when the result becomes
> negative, it rolls over?
>
> A := A - B triggers runtime error 201 when the result is negative.
>
> dec (A,B) rolls over, but triggers runtime error 201 when A is hig
Hi,
How can I subtract two longwords such that when the result becomes
negative, it rolls over?
A := A - B triggers runtime error 201 when the result is negative.
dec (A,B) rolls over, but triggers runtime error 201 when A is higher
than the highest possible value of longint.
Is dec only d