[fpc-devel] Propose: change TComponent.Tag from longint to PtrInt

Luiz Americo Pereira Camara pascalive at bol.com.br
Mon Sep 4 22:21:30 CEST 2006

Daniƫl Mantione wrote:
> In 16 bit days it was considered acceptable to typecast pointers into 
> records and just increase their offset. However, it was not portable. 
> Making your code portable requires some effort. This kind of code is just 
> one example of things you should not do in portable code. If Borland had
> intended this as a pointer , they would have declared it as a pointer.
> Of course there is a simple solution, derive a class and add fields to 
> taste.
For non visual components it's simple, but for LCL/Visual components 
it's a bit more complicated if you plan to use them with the GUI 
designer: you will have to write a package and then install it.
In other cases are worse. Look at the TPage example (which in fact was 
the motivation to suggest this modification since i want a place to 
store a pointer in it): i would have to write a TPage descendant and 
also modify the Lazarus IDE to use it when designing the GUI.


More information about the fpc-devel mailing list