#Can `extern union`s be used for data reinterpretation?
1 messages · Page 1 of 1 (latest)
For example a union with two fields: one is a pointer and another is usize.
Is it safe to first set union's pointer field and then read the usize one.
yes, extern union has a defined memory layout, and it is perfectly legal to reinterpret memory/type pun using defined layouts.