[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 16/22] golang/xenlight: implement keyed union C to Go marshaling
> It actually occurs to me that the "named struct elements of union" would > still technically open up a window for divergence: i.e., if somehow the > type of the named struct didn't match up with the union element. > > I.e., the following *shouldn't* happen, but technically it *could*: > > ---- > struct libxl_domain_build_info_union_hvm { > ... > } > > struct libxl_domain_build_info { > union { > libxl_domain_struct_build_info_hvm2 hvm; > } u; > } > --- > > Using the `typeof` trick above guarantees that the types the marshaling > functions are using are identical to the types actually specified in the > union itself. Particularly as this is just generated code nobody's > going to look at, I'm inclined to think the cost is near-zero. Since > the benefit is non-zero, I'd be inclined to say just go with that instead. > > And it's easier! > > Thoughts? In that case I'll just use the typeof trick :) -NR _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |