Menu

#404 Problems with Procedure Results in Expressions with CHAR-Type  Edit

compiler
open
nobody
None
2022-09-16
2022-09-16
No

Procedures returning CHAR(x) are not treated completly:

x: PROC RETURNS(CHAR(10));
  RETURN('1234567890');
END;

otherProc: PROC;
   DCL b CHAR(20);

    b = x CAT '123';
    b = x.CHAR(1:2);  ! produces wrong C++ code (note 1)
    x.CHAR(1) = 'b';  ! produces compiler error 'x is not in symbol table or is no variable'  (note 2)
END;

Note 1: The runtime system must support a method to deliver a CharSlice for a produre result or another solution the perform selections, which are currently realice in CharSlice.

Note 2: The compiler must not accept a procedure result at the left hand side - except the result is of type REF. In this case there may exist a reasonable solution, since the referenced object has a guaranteed life time at this point. Thus the error message must be more precise. In this case x is no lValue or similar

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB