Remix.run Logo
LexiMax 3 hours ago

A long overdue feature.

Though I do wonder what the chances are that the C subset of C++ will ever add this feature. I use my own homespun "scope exit" which runs a lambda in a destructor quite a bit, but every time I use it I wish I could just "defer" instead.

anilakar 16 minutes ago | parent | next [-]

Various macro tricks have existed for a long time but nobody has been able to wrap the return statement yet. The lack of RAII-style automatic cleanups was one of the root causes for the legendary goto fail;[1] bug.

[1] https://gotofail.com/

surajrmal 44 minutes ago | parent | prev [-]

In many cases that's preferred as you want the ability to cancel the deferred lambda.