"The optional identifier in the case statement serves to access the tag field value, which otherwise would be invisible to the programmer. It can be used to see which variant is active at a certain time. In effect, it introduces a new field in the record. "
"However, it is up to the programmer to maintain this field. "
2. Weiss auch nicht. Das scheint mir in diesem Fall nicht sinnvoll.
type
TTest1 = record
case longint of
1: (i: integer);
1: (f: single);
1: (p: Pointer);
end;
TTest2 = record
case int: longint of
1: (i: integer);
1: (f: single);
1: (p: Pointer);
end;
Mit Lazarus sehe ich grün
Mit Java und C/C++ sehe ich rot
Weil die branches nur im ISO bzw extended Pascal modus Bedeutung haben. In den anderen Modi sind sie einfach nur syntaktischer zucker ohne Semantik, daher ists egal ob sie überlapp haben oder auch unvollständig sind.