Interesting. That does sound very Microsoft. I would strongly prefer not to have something like that in fpc.
Microsoft isn't the only one who has used that "feature". It's not what could be characterized as common but, it isn't really rare either.
It's a lot of "fun" when not only the field size varies but the semantics of the field - including its data type - vary depending on the value of some other variable in the structure/record. Basically a record whose variant is "squeezed" to fit each type.
It's more something of a C programmer's thing than a Microsoft thing.
Programmers always find ways to abuse a feature. <chuckle> I suspect that's what's made the C language popular.
Going back to the topic of the thread, removing the restriction that a variant must be the last field in a record and allowing multiple variants in a record would really ease porting C data structures to Pascal. We live in a C world whether we like it or not.
ETA: And how do I put data in Data? SetLength doesn't work.
I don't really believe it.
you load data in that field the same way you load data into an array (the field is an array), you're simply not respecting the array bounds (whatever they may be) and, since you are ignoring the declared array bounds, you need to either manually, set the count of elements or the size in bytes, into some variable dedicated to hold it for the structure to be usable.
Believe or not... and it's not Ripley's, it's Pascal (and C, C++ and quite a few other languages that implement that "trick".)