[Oberon] Character arrays equality
arturefimov at gmail.com
Tue Apr 16 17:39:44 CEST 2019
In section 8.2.4 of "The Programming Language Oberon" ("Relations") we read:
Relations are Boolean. The ordering relations <, <=, >, >= apply to the
numeric types, CHAR, and character arrays. The relations = and # also apply
to the types BOOLEAN, SET, and to pointer and procedure types.
I have a few questions on character arrays specifically.
1. Is expression "ABC" = "ABC" correct and does it evaluate to TRUE? (This
might be important in some cases.)
2. What if one of the character arrays is a variable and not a constant?
3. What if both character arrays are variables?
4. What if those character arrays (variables) have different length, though
they hold logically-equal null-terminated strings?
5. What if one (or both) of the character arrays is an open array with
VAR a, m: ARRAY 5 OF CHAR;
FOR i := 0 TO 4 DO a[i] := 0X; m[i] := 0X END;
a := "A";
m := "A"; m := "M";
IF a = m THEN ... END
Should we only compare characters before the first 0X?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon