[fpc-pascal] EnumToString

Florian Klämpfl florian at freepascal.org
Tue Nov 1 17:23:29 CET 2011


Am 01.11.2011 10:30, schrieb Juha Manninen:
>      WriteStr (S, N);
> 
> 
> Thanks guys!
> WriteStr() was the function I was looking for.
> I found some places in Lazarus code where it is used but not
> many. Martin's debugger code has some.
> I think many lookup string arrays in Lazarus code could be replaces
> with WriteStr. It would reduce code size and improve code maintenance.
> 
> If I understand right WriteStr uses RTTI internally. So, every enum type
> already carries the string representation at run-time. The
> explicit lookup array is duplicate data.

Not really, if rtti for a certain enum is never used, the linker won't
include it.




More information about the fpc-pascal mailing list