Angelo.Fumagalli@alcatel.it wrote:
How can I have the true "sizeof" of variant records? Gpc sizeof accepts only one parameter as type or variable so isn't possible to specify tags parameters for example:
I tried to use the new statement instead, e.g. but in both cases sizeof return the same value that is the maximum record size.
In GPC that's the "true" size. GPC always allocates the maximum size.
I don't know what you plan to do, but if you're trying to allocate less manually with GetMem etc., that would be dangerous, as assignments can overwrite the "full" size.
If you want to store/load variant parts to/from files, you might better do so fieldwise anyway, for the usual reasons such as padding.
If you need a data structure that allows allocating different amounts of memory, you could look at objects.
Frank