Infinite loop language lawyering
Infinite loop language lawyering
Posted Jul 8, 2024 13:12 UTC (Mon) by khim (subscriber, #9252)In reply to: Infinite loop language lawyering by mathstuf
Parent article: New features in C++26
> For something like C that aims to run on things from 1¢ micro controllers to bog standard desktops to whackadoodle specialized offload cards in HPC, trying to figure out what the different modifiers mean in each case sounds a lot harder than `volatile`'s "something outside of C's model" valve.
As usual the tool that is both convenient and guaranteed is to use a bit different kind of volatile
, specifically asm volatile
. Simple __asm__ __volatile__("");
statement works on all architectures (because all of them accept emply string as assembler input) and it's volatile
thus it has “side effects” and thus couldn't be removed.
Given the fact that most developers who need that tool already have it… there are little desire for the standartization. Although adding something like std::this_thread::no_yield
to already existing std::this_thread::yield would be logical.