Why is the <f64> version size 16 bytes on 64-bit Linux?
I tried this on 64-bit Linux and gave 16:
println!("Results: {}", mem::size_of::<Option<f64>>())
as I understand it, this is because of:
pub struct Discriminant<T>(u64, PhantomData<fn() -> T>);
What is the meaning of the 64-bit discriminant? For hand-written code, 256 will be enough, since the generated 2 ^ 16 code will be a huge number, and I can’t even imagine why 2 ^ 32 is needed. Why use 64 bits for this?
Why doesn't the compiler optimize it for the case Option? 8 bits at the end of the structure should be enough.
+4
1 answer