Re:Java 17 / JDK 17: General Availability
by CodeIsTheEnd on Tuesday September 14, 2021 @10:57AM
(#28525843)
A clarification: Rust only makes this guarantee for certain types[1] which you would expect to be represented by a simple pointer under the hood (e.g., Box<U>, &T, function pointers) and for other types which can never be all 0.
Making this optimization for something like Option<u8> is, naturally, impossible.
(I assume you are aware of this and were implicitly referring to this optimization.)
Making this optimization for something like Option<u8> is, naturally, impossible.
(I assume you are aware of this and were implicitly referring to this optimization.)
[1]: https://doc.rust-lang.org/std/option/#representation