3 ms·
I meant if you have a large program where many types are C unions like: struct TaggedUnion { enum {T1, T2} type_id; union {type1 t1; type2
by awinter-py 10y ago
I meant if you have a large program where many types are C unions like:
struct TaggedUnion {
enum {T1, T2} type_id;
union {type1 t1; type2 t2;} u;
}
If the goal is to translate automatically to a rust enum declaration, that will be (a) possible to do with an automatic tool and (b) will give enhanced safety because it will force the type to be checked everywhere these values are used.