Clang&#x27;s blocks produce atrocious code. Look at the disassembly for:<p><pre><code>    int main(){ __block int (^foo)(int x) = ^ int (int x) { if(x&lt;100) return foo(x+10); return x; }; return foo(69); }
</code></pre>
versus the GCC:<p><pre><code>    int main(){ int foo(int x) { if(x&lt;100) return foo(x+10); return x; }; return foo(69); }
</code></pre>
if you want to see what I&#x27;m talking about.<p>CLANG: <a href="http:&#x2F;&#x2F;pastebin.com&#x2F;37A9by4V" rel="nofollow">http:&#x2F;&#x2F;pastebin.com&#x2F;37A9by4V</a><p>GCC: <a href="http:&#x2F;&#x2F;pastebin.com&#x2F;RMEDnwxi" rel="nofollow">http:&#x2F;&#x2F;pastebin.com&#x2F;RMEDnwxi</a><p>However, defer does look interesting, and implementing it for GCC is very easy:<p><pre><code>    #define defer_(x) do{}while(0); \
            auto void _dtor1_##x(); \
            auto void _dtor2_##x(); \
            int __attribute__((cleanup(_dtor2_##x))) _dtorV_##x=69; \
            void _dtor2_##x(){if(_dtorV_##x==42)return _dtor1_##x();};_dtorV_##x=42; \
            void _dtor1_##x()
    #define defer__(x) defer_(x)
    #define defer defer__(__COUNTER__)
</code></pre>
You don&#x27;t have to use the stupid block-syntax either, just:<p><pre><code>    in = fopen(&quot;whatever&quot;, &quot;r&quot;);
    defer { fclose(in); }</code></pre>