News for hackers. Stuff that matters.
Re:std::launder: the most obscure new feature of C++17 by PhilipRoman on Thursday April 04, 2024 @06:04PM (#39936360)
It doesn't even have to be static. Const is powerful when used on non-pointer types. You can write something like this and the compiler will (on appropriate optimization levels) hard-code return value to 7777 regardless of what "mutate" does:

    extern void mutate(int *p);
    int func() {
        const int foo = 7777;
        mutate(&foo);
        return foo;
    }

There are no comments on this comment yet.