[fpc-pascal]classes for ordinal vars

Michael Van Canneyt michael.vancanneyt at wisa.be
Thu Jan 15 16:27:22 CET 2004


On Thu, 15 Jan 2004, Charl wrote:

> Hi
>
> I have been wondering about creating a unit with classes representing
> normal variable types, like a TIntegerObj, TCharacterObj, etc. The idea
> comes from Java, and I have found some occations when this would have
> been very helpful.
>
> Basically I have two question about this: Is there something similar
> already in the FCL?

No.

> And, what is the performance issues in FP about creating new objects?
> (example:, what kind of performance issues would there be when you
> create and work with a TObjectList with loads of TIntegerObj instances,
> instead of a normal TList containing integer pointers)

There would be a serious slowdown, as each object must be allocated on
the heap. If you want to do such a thing, I suggest you write a separate
heapmanager, which does some optimization for small blocks.

Michael.




More information about the fpc-pascal mailing list