Get the latest tech news

C: Simple Defer, Ready to Use


With this post I will concentrate on the here and now: how to use C’s future lifesaving defer feature with existing tools and compilers.

Indeed, when adding a bit more magic (such as[[gnu::always_inline]]) the assembly that is produced is very efficient and avoids function calls, trampolines and indirections. It has the advantage, I think, that it is much easier and more direct that previous proposals and that it combines the possibility of implementing the feature in the language or in the library. Therefore the defer features is proposed as a “block item” in a compound statement (its anchor) and then defined via the syntax rules

Get the Android app

Or read this on Hacker News

Read more on:

Photo of simple defer

simple defer