On 19 Nov 2002 at 10:11, Eike Lange wrote:
I'm not sure wether it's a feature or a bug but I've read, that setting a case selector in variant records makes some variants unavailable from this point.
ISO-7185 (Pascal) and ISO-10206 (Extended Pascal) say:
6.5.3.3 Field-designators
[...]
It shall be an error unless a variant of a record-variable is active for the entirety of each reference and access to each component of the variant.
So you are correct (a variant part becomes "active" when the selector value matches the associated case constant).
The following program demonstrates, that setting a case selector allows further overwriting of unselected variants:
The standards also say:
3.2 Error
A violation by a program of the requirements of this International Standard that a processor is permitted to leave undetected.
So GPC complies with the ISO standards.
- how _should_ GPC behave?
GPC behaves correctly now, but it would perhaps be more useful if variant assignments were checked at run time as part of the general implementation of range checking (which is on the "to do" list).
-- Dave