Pointers in Tag Property lazarus / 31-LCL ---------------------------------------------------------------------- JimKueneman · 2013-03-24 16:56 In Delphi I would create a class or structure and store a pointer to it in the Tag property of components.  With the cross platform when I cast pointers to integers I get "not portable" messages.  What is the correct cross platform way to store a pointer to a class or structure in a LCL component? Thanks, Jim ---------------------------------------------------------------------- JuhaManninen · 2013-03-24 17:24 Quote from: JimKueneman on March 24, 2013, 05:56:42 pmIn Delphi I would create a class or structure and store a pointer to it in the Tag property of components.  With the cross platform when I cast pointers to integers I get "not portable" messages.  Use PtrInt instead of Integer. Juha ---------------------------------------------------------------------- howardpc · 2013-03-24 22:30 For casting pointers would it not be safer to use PtrUInt? ---------------------------------------------------------------------- taazz · 2013-03-24 22:34 it doesn't make any difference what so ever other than how the compiler will interpret the data in memory when asked to print them. Casting is the action to ask the compiler to handle a piece of memory in as a certain type it does not convert the data in the memory to the type requested. ---------------------------------------------------------------------- Leledumbo · 2013-03-25 03:01 QuoteFor casting pointers would it not be safer to use PtrUInt?Depending on the operation. Tag property is an Integer (signed), so it's better to use PtrInt. But if the operation is some kind of pointer arithmetic (manipulated as integer) then PtrUInt is correct (otherwise you might get negative address). ---------------------------------------------------------------------- PascalDragon · 2013-03-25 16:20 Quote from: Leledumbo on March 25, 2013, 04:01:34 amTag property is an Integer (signed), so it's better to use PtrInt. The first part of that statement is not entirely correct. "Tag" is declared as a "PtrInt" since November 2010, so the signed part is true, but the Integer part only on 32-bit systems.  Regards, Sven ---------------------------------------------------------------------- Leledumbo · 2013-03-25 17:38 QuoteThe first part of that statement is not entirely correct. "Tag" is declared as a "PtrInt" since November 2010OK, I really really seldom touched that property actually