gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Problem with variant records?


From: John B. Wallace, Jr.
Subject: [Gm2] Problem with variant records?
Date: Wed, 15 Sep 2004 21:41:03 -0400

Hello

On my system the code below, compiled with gm2, produces this output:
456
456

With two other Linux/Modula-2 compilers the output is:
123
456

I am using the CVS sources from 01 September 2004 with gcc-3.3.3 on
Red Hat 9 Linux/i586. 


MODULE TestVariantRecord;

FROM StrIO IMPORT WriteLn;

FROM NumberIO IMPORT WriteCard;

TYPE
  String = ARRAY [0..255] OF CHAR;
  DataType = (card,string);
  RcdType = RECORD
              CASE Data : DataType OF
                card   :  j : CARDINAL;
                          k : CARDINAL |
                string : st : String 
              END (* CASE *)
            END; (* RECORD *)
      
VAR
  R1 : RcdType;

BEGIN
  WITH R1 DO
    Data := card;
    j := 123;
    k := 456;
    WriteCard(j,0);
    WriteLn;
    WriteCard(k,0);
    WriteLn
  END (* WITH *)
END TestVariantRecord.


John Wallace



reply via email to

[Prev in Thread] Current Thread [Next in Thread]