[fpc-devel] Generics - a general question

AvP downloaditweb at googlemail.com
Sat Nov 19 09:33:11 CET 2011


First of all, thanks for your answer.
I tried to make the example as simple as possible - and simply forgot to 
allocate the memory :$

> Simply replacing "object" by "class" is not sufficient, because classes
> need to be used differently than objects.
Right, it actually needs a bit of modification in the destructor. ;-)

>objects aren't used by that many persons
As I started / learned programming with TurboPascal, I habitually use objects, 
but is there a big difference for "the normal user", if advanced class 
features aren't used?
Is there a difference in speed / memory consumption / code size between 
objects and classes?

Back to generics:
How much does a specialized generic class / object differ from a class / 
object, that is directly programmed (not as generic), in the binary code ?

The reason for my question is that I often read that you shouldn't use 
generics if a programm heavily depends on speed (like 3D-games). So is this 
really an issue in FreePascal (like it seems to be in C-like languages) and 
how big is the difference in speed - if there is any?

Many questions, but hopefully it will make things more clear to me.

Thanks
A.v.P.



More information about the fpc-devel mailing list