Hi.
I'am porting some code from 32 to 64 bit. And I found that TComponent.Tag is longint tj. 32bit. In my code is common to store Pointer into Tag, but this is in 64bit inpossible.
What about to change Tag type to SizeInt.
Petr

Mailing lists / fpc-devel / 2008-03
7 messages · 5 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi.
I'am porting some code from 32 to 64 bit. And I found that TComponent.Tag is longint tj. 32bit. In my code is common to store Pointer into Tag, but this is in 64bit inpossible.
What about to change Tag type to SizeInt.
Petr
Inspired by borland.delphi.public.non-technical?
Best regards,
Paul Ishenin.
Hi. I'am porting some code from 32 to 64 bit. And I found that TComponent.Tag is longint…
This has been discussed before:
It could be problematic if a Tag is streamed and read on different platforms. It would better to introduce a new (non streamable) SizeInt property.
Vincent
In fpGUI I introduced the following...
public
property TagPointer: Pointer read FTagPointer write FTagPointer;Non-streamable, but handy. Would that work?
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Inspired by borland.delphi.public.non-technical? Paul Ishenin.
No, this is necessity. I do not know how to effectively change my code to not use Tag property.
Petr
In fpGUI I introduced the following... public property TagPointer: Pointer read…
At work I completely abanonded putting pointers in tags, but I use a Map like object inbetween:
on create:
SomeObject.Tag := GetnextTagSequence;
ObjectMap.Add(someObject.Tag, someObject);on use:
if ObjectMap.GetData(someObject.Tag, someObject) then someObject.dosomething
On destroy of SomeObject is is removed form the map. Advantage is that if the tag is passed to different routines, if the map cant find the object, it is destroyed, so you never reference a destroyed object.
Marc
Marc Weustink wroteAt work I completely abanonded putting pointers in tags, but I use a Map like object inbetween:
And a much better (cleaner) design at that! I like it. :)
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/