Dennis
2018-07-23 10:23:59 UTC
I am trying out the examples at
http://wiki.freepascal.org/Enumerated_types but
The following simple program will raise compiler error "No type info
available for this typ"
I am using Lazarus 1.8.0 FPC 3.0.4 x86_64-Win64-win32/win64
program testenum;
uses typinfo, classes, sysutils;
type
TMonthType = (January=1, February, May=5,June, July);
var i : int32;
s : String;
begin
for i := Ord(Low(TMonthType)) to Ord(High(TMonthType)) do
begin
s:= GetEnumName(TypeInfo(TMonthType), Ord(i)); <- compiler error
pointed at the word TypeInfo
Writeln(i.ToSTring+' -> '+s);
end;
readln;
end.
However, if I change to
TMonthType = (January, February, May,June, July);
The compiler error will disappear.
Is this kind of enumerated type with constant assignment not supported
by FPC 3.0.4?
TMonthType = (January=1, February, May=5,June, July);
Dennis
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listi
http://wiki.freepascal.org/Enumerated_types but
The following simple program will raise compiler error "No type info
available for this typ"
I am using Lazarus 1.8.0 FPC 3.0.4 x86_64-Win64-win32/win64
program testenum;
uses typinfo, classes, sysutils;
type
TMonthType = (January=1, February, May=5,June, July);
var i : int32;
s : String;
begin
for i := Ord(Low(TMonthType)) to Ord(High(TMonthType)) do
begin
s:= GetEnumName(TypeInfo(TMonthType), Ord(i)); <- compiler error
pointed at the word TypeInfo
Writeln(i.ToSTring+' -> '+s);
end;
readln;
end.
However, if I change to
TMonthType = (January, February, May,June, July);
The compiler error will disappear.
Is this kind of enumerated type with constant assignment not supported
by FPC 3.0.4?
TMonthType = (January=1, February, May=5,June, July);
Dennis
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listi