[Oberon] Clarifying type compatibility in Oberon-07

Jörg joerg.straube at iaeth.ch
Sun Oct 8 09:36:25 CEST 2017


> 
> On 2017-10-08 08:20, Jörg wrote:
>> Chris
>> A question and I’m really curious to get your opinion
>> Would you allow this as well?
>> MODULE X
>> VAR a*: RECORD real, img: REAL END;
>> MODULE Y;
>> IMPORT X;
>> VAR b: RECORD x, y: REAL END;
>> b := X.a
> 
> Even C uses name equivalence for record types (structs), but the reason for this is that the variables may have different alignment (even though they have the same structure).

In Oberon the alignment is part of the type.
You can see BYTE as an INTEGR with another alignment. BYTE aligns on byte boundary, INTEGER aligns on 32bit boundary. So in Oberon they would structurally not match.

br
Jörg


More information about the Oberon mailing list