[fpc-pascal]More strangeness...
Matt Emson
memsom at interalpha.co.uk
Fri Aug 29 17:48:47 CEST 2003
> In the development branch THandle is a Cardinal. In the stable 1.0.x
> branch we left it an Longint. In the past there were some issues in the
> with Cardinal. At that moment it was decided to leave thandle at longint.
> And it has been already a longint for 5 years. When it was really a
> problem then it would have been noticed much earlier.
Peter, longint is simply wrong. whist is may work in most circumstances, if
you are on a system with a lot of handles being allocated, you will get to
the realms on 32bit unsigned values. As the normal test for a handle
allocation is :
h := AllocateSomeHandle;
if (h > 0) then Success
else Recover;
you are simply asking for trouble. A negative handle value is not
acceptable. I'm guessing the problems have been got around by the shear luck
of a silent cast when passing an longint to a function expecting a longword.
However it's possible that L D Blake has stumbled accross somewhere where
this is not possible.
It's not actually a Cardinal, it's a DWORD that is the normal Win32 type.
DWORD is mapped to LongWord in Delphi and therefore Cardinal.
Matt
More information about the fpc-pascal
mailing list