transmute
transmute
Posted Jul 12, 2022 11:00 UTC (Tue) by tialaramex (subscriber, #21167)In reply to: EXCELLENT! by pbonzini
Parent article: Rust frontend approved for GCC
Transmute is hideously dangerous *anyway* but not directly because of aliasing concerns. For example you can transmute some bytes you found into a string, which Rust then assumes is UTF-8 encoded. Or you can transmute the integer 0 into a NonZeroUsize, and then hand that to APIs which explicitly took NonZeroUsize because they can't handle zeroes. Or transmute 69 into a bool which is now sometimes neither equal to true nor false. Nice. Wait, no, that's not nice at all.
Posted Jul 12, 2022 13:42 UTC (Tue)
by nix (subscriber, #2304)
[Link]
transmute
Or transmute 69 into a bool which is now sometimes neither equal to true nor false. Nice. Wait, no, that's not nice at all.
Sounds like the perfect thing to use to encode SQL NULL :P