Hi all
  We can use tagpo propertie to store 64b pointer also.

Med
________________________________
De : Sieghard <s_c_...@arcor.de>
Envoyé : mercredi 16 juin 2021 00:56
À : mseide-msegui-talk@lists.sourceforge.net 
<mseide-msegui-talk@lists.sourceforge.net>
Objet : Re: [MSEide-MSEgui-talk] Conversion between ordinals and pointers is 
not portable ?

Hallo fredvs,

Du schriebst am Sat, 12 Jun 2021 13:57:08 -0700 (MST):

> Thanks, very clear.

Thank you.

> I did research about this in Lazarus forum and their solution for the
> "ptruint" hint is to use this:
>
>      {$push}
>      {$hints off}{$warnings off}
>    ... // code using ptruint
>      {$pop}
>
> ;-) !

Oooopss...
VERY dangerous - seems they don't really use this internally.
Would they, and would someone attempt to really store a 64 bit pointer
in such a variable, this probabely would produce a wrong pointer on
retrieval and possibly data or even code corruption.
32 bits of a DWord simply aren't sufficient to store the 64 bits of a
pointer on a 64 bit system. They might get away as long as process
memory isn't mapped at more than (3...)4G Bytes, but above that, cruel
things might happen...

The compiler warning _has_ a reason, and I'd plea to keep it.
If someone _knows_ it doesn't apply to his use, he may reasonably ignore
it. If not, it _will_ be better to find a work-around.
BTW, do you remember some upheaval when such a warning appeared for the
use of the "Tag" property to store a pointer value on a 64 bit system?
Martin even extended this property to a 64 bit type just for such a use.
The Lazarus people don't seem to have realized the possible pitfalls of
their lazyness at handling this case.

--
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------



_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to