Someone asked a question some weeks back about why size_of::<Option<T>>
is always double. Answer is because of alignment.
C
doesn't have the ability to directly represent complex Rust enum, hence, the need for a workaround. To understand that, let's take a look at how Option<i32>
is represnted in C
.
E.g. Given: