On 15 Jun 2001, at 18:10, Frank Heckenbach wrote:
However, I'm not sure if EP actually allows such structured constants in a `case' statement. Anyone knows?
The EP standard requires a "constant-expression" for the case-constant in a case-range in a case-constant-list. A constant-expression is an "expression" that "...shall be nonvarying and shall not contain a discriminant-identifier" (6.8.2). So the use of:
case lt of imn[mxstarts] : ...
...should be legal, as "imn[mxstarts]" is a "constant-access", assuming:
type integer_options = (max_untyp, mxstarts, nfuncmax); array_options = array [integer_options] of char;
const imn = array_options [max_untyp : 'u'; mxstarts : 'r'; nfuncmax : 'n'];
var lt : char;
This should be semantically equivalent to:
case lt of 'r' : ...
...it should probably be an EP style constant (which GPC doesn't support completely yet, AFAIK)...
The first item under Section 11.2.2 of the GPC Manual lists "ISO structured constants" as yet to be implemented, and the above code fails to compile, so I believe that you are correct. :-(
-- Dave