News for hackers. Stuff that matters.
Re:std::launder: the most obscure new feature of C++17 by tux3 on Thursday April 04, 2024 @04:42PM (#39935570)
As far as complicated features that very few people understand or use and that are hard to implement correctly in compilers, std::launder ranks pretty high.

Topping the list, for me, would be memory_order_consume. It's so complicated and for such a slight extremely technical memory ordering optimization, compilers have mostly given up hope of ever implementing it.

There was even talk of outright removing it from C++, but looks like it still stands today. I've never seen it used correctly (and even if it were, compilers just throw up their hands at it)

Re:std::launder: the most obscure new feature of C++17 by ric129 on Thursday April 04, 2024 @05:11PM (#39935843)
I recall plenty of implementations turning into the same as a memory_order_acquire, which seems fine these days
Re:std::launder: the most obscure new feature of C++17 by loeg on Thursday April 04, 2024 @05:24PM (#39935955)
> On all mainstream CPUs other than DEC Alpha, dependency ordering is automatic, no additional CPU instructions are issued for this synchronization mode, only certain compiler optimizations are affected (e.g. the compiler is prohibited from performing speculative loads on the objects that are involved in the dependency chain).

> Note that currently (2/2015) no known production compilers track dependency chains: consume operations are lifted to acquire operations.

https://en.cppreference.com/w/cpp/atomic/memory_order#Releas...