To me it seems like some kind of trick, to extend a record at runtime.
The empty record field, functions as a sort of offset/label/pointer if you
will to the new fields that will will be extended to the record by simply
allocating more memory then the size of the record.
Then this "label"/"field" can be used as a sort of offset, by typecasting it
to some extension record type.
Could be pretty handy, quite impressive trick.
However, is it safe to use ?
I cannot find anything in the documentation about this ?
Seems to be an old trick as well.
Gonna copy this stuff and ask on free pascal compiler list, maybe they know
something about this ;) I wonder if free pascal supports this trick as well
;)
Bye,
Skybuck.
"Skybuck Flying" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello,
What's going on here:
type
TsomeRecord = record
SomeField : integer;
SomeEmptyRecord : record end;
end;
How can SomeEmptyRecord be usefully used ?
What is it ?
SizeOf(TsomeRecord) returns 4, kinda weird ?!
Bye,
Skybuck.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal