Re: [fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Sven Barth
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 _

Re: [fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Tomas Hajny
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

Re: [fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Mark Morgan Lloyd
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

Re: [fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Klaus Hartnegg
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

Re: [fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Tomas Hajny
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

[fpc-pascal] subtract longwords with rollover

2013-11-28 Thread Klaus Hartnegg
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

Re: [fpc-pascal] CRITICAL Bug in Lnet DNSLookup failure problem

2013-11-28 Thread Mark Morgan Lloyd
Dennis Poon wrote: when using lnet to connect to a remote server at DomainName : Port e.g. yahoo.com : 80 in file lCommon.pp line 492: function StrToNetAddr(const IP : String) : Sockets.in_addr;inline; begin result := Sockets.StrToNetAddr(IP); end; The above function did not raise exceptio

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-28 Thread Tomas Hajny
On Thu, November 28, 2013 09:03, Sven Barth wrote: > Am 28.11.2013 08:33, schrieb Andreas Schneider: >> Maybe a bit late, but that might not be true. If Timothy really talks >> about _object_ (and not _class(TObject)_) it should work as he does >> it. Also Destroy would probably be appropriate. Jus

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-28 Thread Sven Barth
Am 28.11.2013 08:33, schrieb Andreas Schneider: Maybe a bit late, but that might not be true. If Timothy really talks about _object_ (and not _class(TObject)_) it should work as he does it. Also Destroy would probably be appropriate. Just saying :-) The actual type defs used are missing. Unli