News for hackers. Stuff that matters.
Re:Proposal to add constexpr to C [pdf] by bonzini on Sunday October 17, 2021 @03:33AM (#28894652)
It's not silent, you do declare that you want it released; you just do it before and it applies to all early returns. For example

    MUTEX_LOCK_GUARD(&lock)
        for (i = 0; i < n; i++)
            if (a[i] == x)
                return i;
    return -1;
Real world example here: https://github.com/qemu/qemu/blob/master/block/iscsi.c#L325

And the implementation: https://github.com/qemu/qemu/blob/master/include/qemu/lockab... (after inlining, the abstraction is completely zero cost).

There are no comments on this comment yet.