[fpc-pascal]More strangeness...
Marco van de Voort
marcov at stack.nl
Fri Aug 29 23:59:09 CEST 2003
> In reply to your message of August 29, 2003
>
> >> Peter, longint is simply wrong.
>
> > Is it?
>
> Yeah totally wrong... A negative handle??? Think about it...
Yes I think about it. Typed negative on this side (the pascal side). On
2-complements it is the same binary layout, only the interpretation is
different. The win32 API sees no difference, since it puts its own typing
over it.
So signed<->unsigned isn't really a problem as long as you don't move between
types with various sizes.
Wrong sizes are a problem, but ....
> > Moreover, I agree with Peter, HWND's are used really a lot. Inside FPC,
> > ICS, Lazarus etc etc.
>
> Yep, well here's the rub... I took an older system I have laying about and set
> it up witn win98 and ran my project... it doesn't do it there! According to
> the SDK that's because 9x versions don't assign handles above 65,535 ... i.e.
> only the low word of the 32 bit handle is used, which won't cause a range
> check error.
I've played with Active Directory, services and some other win2000 feats,
in total 2 years,
and have been porting ICS (1 or 2 MB TCP/IP code, multithreading, heavily
messaging) for two weeks now on XP.
However that was mostly with 1.1.
> > It would have been detected.
>
> Not if...
> A) nobody is using direct winapi calls on nt/2k/xp or
> B) nobody bothered to report it.
>
> One has to ask how many people tried this, ran into trouble and just moved on
> to some other compiler without ever bothering to report it...
>
> Matt is right... Longint is absolutely the wrong declaration for a window
> handle.
Unless you do arithmetic with it, it shouldn't matter.
More information about the fpc-pascal
mailing list