<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>future feature | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/future-feature/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Tue, 15 Dec 2020 09:11:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>future feature | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>A possible defer mechanism for C</title>
		<link>https://learncgames.com/a-possible-defer-mechanism-for-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-possible-defer-mechanism-for-c</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Thu, 17 Dec 2020 00:00:26 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[future feature]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2083</guid>

					<description><![CDATA[<p>I remember that some other programming language (possibly Go) has a defer mechanism. You can tell it to defer a function call until the end of the function. I think this means, even if you do an early return that all functions that have been deferred will still run.  It&#8217;s a handy language feature. Alternatives [&#8230;]</p>
The post <a href="https://learncgames.com/a-possible-defer-mechanism-for-c/">A possible defer mechanism for C</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:317,&quot;href&quot;:&quot;https:\/\/gustedt.gitlabpages.inria.fr\/defer&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260114212839\/https:\/\/gustedt.gitlabpages.inria.fr\/defer\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 13:50:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 12:31:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-21 11:56:55&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 11:56:55&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:318,&quot;href&quot;:&quot;https:\/\/gitlab.inria.fr\/gustedt\/defer&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260112201853\/https:\/\/gitlab.inria.fr\/gustedt\/defer&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 13:50:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 12:31:40&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-21 11:56:55&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 11:56:55&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:319,&quot;href&quot;:&quot;https:\/\/en.wikipedia.org\/wiki\/Setjmp.h&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260126094634\/https:\/\/en.wikipedia.org\/wiki\/Setjmp.h&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 13:50:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 12:31:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-21 11:56:53&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 11:56:53&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img fetchpriority="high" decoding="async" class="alignleft size-medium wp-image-2085" src="https://learncgames.com/wp-content/uploads/2020/12/place-name-sign-1647341_640-300x198.jpg" alt="Next big thing sign" width="300" height="198" srcset="https://learncgames.com/wp-content/uploads/2020/12/place-name-sign-1647341_640-300x198.jpg 300w, https://learncgames.com/wp-content/uploads/2020/12/place-name-sign-1647341_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" />I remember that some other programming language (possibly Go) has a <strong>defer</strong> mechanism. You can tell it to <strong>defer</strong> a function call until the end of the function. I think this means, even if you do an early return that all functions that have been deferred will still run.  It&#8217;s a handy language feature. Alternatives to it ion say C# are try &#8230; finally where the finally ensures that code gets runs.</p>
<p>The reason for mentioning this is it&#8217;s a possibility for a future inclusion in the next C standard.  There&#8217;s a quite long <a title="Link to article about defer" href="https://gustedt.gitlabpages.inria.fr/defer/" target="_blank" rel="nofollow noopener">article about defer</a> listing benefits. But even better the author Jens Gustedt has provided a reference implementation of it on <a title="Link to default implemenation of defer on Gitlab" href="https://gitlab.inria.fr/gustedt/defer" target="_blank" rel="nofollow noopener">GitLab</a>.</p>
<p>I&#8217;m all in favour of this. Adding new features to C is not something to be done lightly but error checking and handling in C has always been a bit iffy. I&#8217;ve never used a <a title="Link to Setjmp on Wikipedia" href="https://en.wikipedia.org/wiki/Setjmp.h" target="_blank" rel="nofollow noopener">SetJmp</a> for example.  I do hope that defer gets added to C though I can&#8217;t see it being there for a few years.</p>The post <a href="https://learncgames.com/a-possible-defer-mechanism-for-c/">A possible defer mechanism for C</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2083</post-id>	</item>
	</channel>
</rss>
