[Oberon] Compiler behaviour for a32 := a8
August Karlstrom
fusionfile at gmail.com
Tue Feb 2 12:20:57 CET 2021
On 2021-02-02 01:55, Chris Burrows wrote:
> Note that when the language was updated he did add:
>
> 4. An open array may be assigned to an array of equal base type
>
> Which should allow you now to write:
>
> TYPE
> Ident = ARRAY 32 OF CHAR;
> VAR
> a8: ARRAY 8 OF CHAR;
> a32: ARRAY 32 OF CHAR;
> id1, id2: Ident;
>
> PROCEDURE Assign(VAR dst: Ident; src: ARRAY OF CHAR);
> BEGIN
> dst := src
> END Assign;
> ...
> ...
> Assign(id1, a8);
How can we conclude from the language report that a shorter array can be
assigned to id1? Sure, it makes sense for strings but what about
non-character arrays? The statement above may as well trigger a run-time
exception.
> Assign(id2, a32);
This should be valid though.
-- August
More information about the Oberon
mailing list