Re: GPC BUG: Initializer for tagged variant records does not work
17 Jun
1999
17 Jun
'99
4:28 p.m.
Oregon Pascal doesn't have initializers as such, but it does have structured constants. The syntax for assigning structured constants would be : type t = record f1 : integer; case tag : integer of 0: (i : integer); 1: (r : real); end; var r_int, r_real : t; begin r_int := (1, 0, (42)); r_real := (1, 1, (3.14)); end. Ie. The variant part looks like another record nested within the main one and the tag appears as a normal field. Helpfully, Richard. PS. type t = record f1 : integer; case 0 .. 1 of 0: (i : integer); 1: (r : real); end; Would also work using the same assignment syntax, and saves space in the record as there's no actual tag field.
9945
Age (days ago)
9945
Last active (days ago)
0 comments
1 participants
participants (1)
-
richard.kerry@quantel.com