On Sat, Jun 11, 2022 at 2:40 AM Bo Persson via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On 2022-06-10 at 23:09, Arthur O'Dwyer via Std-Proposals wrote:
>
> I think I need to re-post this paragraph.
>
> Here's another way to look at it: *"Optimization barrier" is not a
> first-class principle.* Instead, the fundamental organizing principle is
> *"The tool can't optimize what it can't see."* So, if you really really
> want something not to be optimized, then you simply mentally reduce the
> problem to "How can I make my optimizing tool /not see/ this function?"

So perhaps what we need is a [[dont_look]] directive?

If the optimizing tool you're trying to hide from is specifically a tool that consumes .cpp files (and recognizes that directive), then yeah, sure.
If it's a tool like Green Hills' elxr that consumes .o files containing binary code, then of course putting a source-level directive won't work.
If it's a Perl script that doesn't understand `[[` syntax, then of course that won't work.
You always need to think about "What am I actually trying to accomplish here? What is my goal? What optimizing tool am I trying to interact with?"

–Arthur