[fpc-pascal] How to create this "union" ?

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Dec 26 19:49:16 CET 2011


On 26 Dec 2011, at 19:42, Jeppe Græsdal Johansen wrote:

>>    union {
>>        struct xt_entry_match **match;
>>        struct xt_entry_target **target;
>>    };
>>    void *xt_entry;
>>    void *udata;
>> }
...
>  case integer of
>   0: (match: ^Pxt_entry_match; xt_entry, udata: pointer);
>   1: (target: ^Pxt_entry_target);
> end;

While that does happen to work here, it's not a good way to translate such records because it's easy to make mistakes in case not all parts of the union are of the same size.


Jonas


More information about the fpc-pascal mailing list