[fpc-devel] Macro Processing

Daniël Mantione daniel.mantione at freepascal.org
Sat May 14 09:54:43 CEST 2011


Op Sat, 14 May 2011, schreef Joerg Schuelke:

> 2) This is the solution? Making the compiler to store somewhere a
> string representation in my object file and then give it back to me if
> I request it by str(enumerate)???

All types (not just enums) have runtime type information that is stored in 
the object file. Runtime type information is very powerfull and has many 
applications, for example memory management for automatic types, or the 
population of a TForm with data entered in the GUI in Lazarus. Converting 
an enum to a string is another application of runtime type information.

> Thats so completely ... overhead, with a cannon to shoot a sparrow.

There is no overhead because any unused RTTI is removed when smartlinking.

> Since when has an enumeration such  kind of name, which lives outside 
> compile time?

RTTI is quite old already, but the compiler can convert between enums and 
strings since version 2.3.

Daniël


More information about the fpc-devel mailing list