[fpc-devel] Macro Processing

Jonas Maebe jonas.maebe at elis.ugent.be
Sun May 15 20:06:02 CEST 2011


On 15 May 2011, at 17:53, Joerg Schuelke wrote:

> The example with that small enumeration is not that bad, you think. The
> overhead is what?, somehow 52 bytes data and maybe hundert of code. You
> say its low, I say the example is very small too!
> 
> The same can be done with 0 bytes additional data and 0 bytes
> additional code. In three ways:
> - using compile time information (ugly build-in macro)
> - using an macro
> - keeping them in sync by hand (thats not the worst)
> And thats the point.

Those three ways also have data overhead, because you have to store the string representation somewhere. Whether this initialised data is part of a predefined format called "RTTI" or not does not change that. Additionally, the RTTI's code overhead goes down (percentage-wise) when the examples become bigger, since there is one generic routine for lookups that is reused in all cases. And of course, not using RTTI does not mean that no code has to be generated for the lookups (indexing an array also requires code).


Jonas


More information about the fpc-devel mailing list