Enumerated types_(re)

Mon, 9 Jun 1997 14:22:04 +0200



Peter Gerwinski wrote:

> If everybody agrees that there should be an extension like this in GPC:
> It's probably not so hard to implement.  Suggestions for the syntax?
> Objections against it?

Why not? If it's not too much work to do.
Could it be a problem if Ord(EnumVal)<0 ? I don't see any.

Suggestion:

type TComparisonResult=(Less value -1, Equals, Greater, Strange value 10);

i.e. Ord(Less)=-1, Ord(Equals)=0, Ord(Greater)=1, Ord(Strange)=10.

Disadvantage: Range checking will get more difficult.
-- 
Frank Heckenbach, Erlangen, Germany
heckenb@mi.uni-erlangen.de
Turbo Pascal:   http://www.mi.uni-erlangen.de/~heckenb/programs.htm
Internet links: http://www.mi.uni-erlangen.de/~heckenb/links.htm


Frank Heckenbach (heckenb@mi.uni-erlangen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es