[Oberon] Clarifying type compatibility in Oberon-07
Andreas Pirklbauer
andreas_pirklbauer at yahoo.com
Sun Oct 8 11:27:41 CEST 2017
> On Sun Oct 8 09:36:25 CEST 2017 Jörg Straube wrote:
>
> > On Sun Oct 8 09:29:33 CEST 2017 August Karlstrom wrote:
> > 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
>
Historical note:
In the past (Algol, Pascal, Modula) there was an additional reason for assuming name equivalence as the basis for establishing type consistency rather than structural equivalence: variant records! They make the implementation of structural equivalence more complex and constituted an inherently nasty subject for compiler implementors.
Variant records were eliminated in the step from Modula to Oberon, so we are now left with alignment problem to deal with.
-AP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20171008/bd160b75/attachment.html>
More information about the Oberon
mailing list