Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-11

WriteStr and int-range types (eg TColor)

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin

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

But should/could it also work on sub-range types of int? Like

   TGraphicsColor = -$7FFFFFFF-1..$7FFFFFFF;
or even
TFoo = type integer;

Reply by email

Jonas Maebe
to Martin
Martin wrote
I know WriteStr can be used to get the names of enum: WriteStr(s, enumOne)

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

Show quoted text 6 lines
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

Reply by email