Jürgen Hestermann schreef:
Therefore, there is absolutly no difference between
TFigure = record
X : TShapeList;
case TShapeList of
Rectangle: (Height, Width: Real);
Triangle: (Side1, Side2, Angle: Real);
Circle: (Radius: Real);
Ellipse, Other: ();
end;
and
TFigure = record
case X : TShapeList of
Rectangle: (Height, Width: Real);
Triangle: (Side1, Side2, Angle: Real);
Circle: (Radius: Real);
Ellipse, Other: ();
end;
It ends up in the same record and also the programmer does not see any
difference. He can store whatever he wants in X in both cases. It has no
influences on the variants.
IIRC, there is a difference. With the second declaration the compiler can add a
run-time check that the correct memebrs are accessed based on the value of X.
Unfortunately, I cannot find the compiler switch.
Vincent
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal