[comp.lang.modula2] Structured return values

Ben.Stuyts@p6.f202.n281.z2.fidonet.org (Ben Stuyts) (04/16/91)

 MS> Can function procedures in Oberon return structured values?
 MS> In Modula-2 they cannot,

I think in Modula-2 this is implementation defined. I don't recall
that Wirth explicitely says something about this.

At least the Rowley modula-2 compiler allows you to return structured
values from procedures. Something like this is legal:

MODULE Ret;

TYPE
  Rec = RECORD
    a,b,c,d: REAL;
  END;

  Arr = ARRAY [0..10] OF LONGCARD;

PROCEDURE a(): Rec;
VAR b: Rec;
BEGIN
  RETURN b;
END a;

PROCEDURE c(): Arr;
VAR b: Arr;
BEGIN
  RETURN b;
END c;

BEGIN
END Ret.


Best regards,
Ben


--  
uucp: uunet!m2xenix!puddle!2!281!202.6!Ben.Stuyts
Internet: Ben.Stuyts@p6.f202.n281.z2.fidonet.org