Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-03

TComponent.Tag type

7 messages · 5 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Paul Ishenin
to Unknown author
Show quoted text 7 lines
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.

Inspired by borland.delphi.public.non-technical?

Best regards,
Paul Ishenin.

Reply by email

Vincent Snijders
to Unknown author: Hi. I'am porting some code from 32 to 64 bit. And I found that TComponent.Tag is longint…
Show quoted text 7 lines
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.

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

Reply by email

Graeme Geldenhuys
to Vincent Snijders
Show quoted text 6 lines
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.

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/

Reply by email

Unknown author
to Paul Ishenin: Inspired by borland.delphi.public.non-technical? Paul Ishenin.
Paul Ishenin wrote 10 lines
wrote: >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. Inspired by borland.delphi.public.non-technical?

No, this is necessity. I do not know how to effectively change my code to not use Tag property.

Petr

Ing. Petr Kristan . EPOS PRO s.r.o., Bozeny Nemcove 2625, 530 02 Pardubice tel: +420 466335223 Czech Republic (Eastern Europe) fax: +420 466510709

Reply by email

Marc Weustink
to Graeme Geldenhuys: In fpGUI I introduced the following... public property TagPointer: Pointer read…
Graeme Geldenhuys wrote 14 lines
> 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. > In fpGUI I introduced the following... public property TagPointer: Pointer read FTagPointer write FTagPointer; Non-streamable, but handy. Would that work?

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

Reply by email