[fpc-pascal] WriteStr and int-range types (eg TColor)

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Nov 26 16:16:44 CET 2011


On 26 Nov 2011, at 16:10, Martin wrote:

> I know WriteStr can be used to get the names of enum: WriteStr(s, enumOne)

Plain Str also works: Str(enumOne,s).

> But should/could it also work on sub-range types of int?
> Like
>  TGraphicsColor = -$7FFFFFFF-1..$7FFFFFFF;
> 
> or even
> TFoo = type integer;

Do you mean Str(TGraphicsColor,s)? In that case: no, str/writestr cannot be used to get type names, variable names etc. They only support converting actual (ordinal, integer, floating point and enumeration) *values* to their corresponding string representations.


Jonas


More information about the fpc-pascal mailing list