News for hackers. Stuff that matters.
Re:std::launder: the most obscure new feature of C++17 by Someone on Thursday April 04, 2024 @06:35PM (#39936643)
For C++, you would be wrong. You can use it for variables that your code won’t change (hence const), but that can change due to outside events and hence can’t be cached in a register (hence volatile)

See https://www.embedded.com/combining-cs-volatile-and-const-key... for examples, https://en.cppreference.com/w/cpp/language/cv for a more formal description.

Re:std::launder: the most obscure new feature of C++17 by Rucadi on Thursday April 04, 2024 @07:31PM (#39937108)
In a Memory Mapped device, a read can trigger side effects (in fact, I worked a lot with that), so is not only is about memory.
Re:std::launder: the most obscure new feature of C++17 by cryptonector on Friday April 05, 2024 @12:29AM (#39938696)
Yes, I'm aware, and thus I said "would". But I wouldn't make use of this without first reading the spec on that very carefully. Thankfully I've not needed this.