Scrive Arno Garrels <>:

> Francois PIETTE wrote:
> >>>   "if FClientNum >= $7FFFFF then"
> >>> currently it wraps around after 8,388,607
> >> 
> >> That is probably my bug, missed an F.
> > 
> > Should probably be MAXINT to avoid any issue with integer size change.
> And a cast of FClientNum to an unsigned integer is required, otherwise 
> the equal or greater comparison won't work if for some reason an integer
> overflow already happend. If Integer will ever be changed in size I 
> guess that Cardinal gets the same size.

Cardinal and Integer should not change since (IIRC) NativeInt and NativeUInt 
was introduced to handle 32/64 bit cpu.

> if Cardinal(FClientNum) >= MaxInt then
>     FClientNum := 0;

FClientNum is declared as LongInt, so maybe MaxLongint should be used.

And why don't invert the test?

if FClientNum) < MaxLongint then
    FClientNum := 1;

Bye, Maurizio.

This mail has been sent using Alpikom webmail system

To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to