From: | Hans-Peter Diettrich <DrDiettrich1@aol.com> |
Newsgroups: | comp.compilers |
Date: | Wed, 29 Dec 2010 17:01:59 +0100 |
Organization: | Compilers Central |
References: | 10-12-040 10-12-052 |
Keywords: | storage, design |
Posted-Date: | 30 Dec 2010 10:58:30 EST |
noitalmost schrieb:
> I suppose I have an initial prejudice against variant records. They seem to me
> to be a potential source of hard to find bugs (for the user programmer, I mean,
> not the compiler designer). Am I wrong about this? Is it possible for the
> compiler to always know which type is active in the variant, like say through
> a hidden compiler-generated variable in the record?
Most (Wirthian) variant records have an (optional) Tag field, but most
implementations don't use it for the selection of one variant at
runtime, most probably for compiler simplicity and performance issues.
Ada may be more strict here (dunno).
At least there must exist rules for what happens when the Tag field is
changed. IMO the variant part should be cleared then - otherwise the Tag
if of no real value for the compiler and coder.
DoDi
Return to the
comp.compilers page.
Search the
comp.compilers archives again.