News for hackers. Stuff that matters.
Re:C++26: Std:Is_within_lifetime by tialaramex on Thursday February 19, 2026 @10:39AM (#47074983)
Barry even explains, the transmutation is outlawed during compile time in C++. They could remove this prohibition but they did not.

Notice that e.g. Rust doesn't prohibit compile time transmutation, the provided core::mem::transmute literally does this operation, and it's const. The result is - as with similar situations in C++ - that if at compile time that's a 2 the compilation fails, 2 is not a boolean. You don't need all this bother because Rust's type system is better so Option<bool> already does have the same size as bool, but that's beside the point.

There are no comments on this comment yet.