<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Zig</title>
		<link>http://www.allegro.cc/forums/view/618226</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 14 Sep 2020 13:18:07 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Has anyone else come across the programming language Zig?<br /><a href="https://ziglang.org/">https://ziglang.org/</a><br />It&#39;s being developed as a replacement for C and it has good interoperability with C libraries. It has some interesting features like the way it handles errors.<br />I had a quick go at using it with Allegro - I just translated the ex_blit example. This was fairly straightforward and performance was similar to the original. However I&#39;m not convinced it was a massive improvement either, although I&#39;m sure if it were written as a Zig program (rather than a conversion) it would make better use of the features.<br />Have a look here:<br /><a href="https://github.com/pedro-w/zigallegro/blob/master/src/main.zig">https://github.com/pedro-w/zigallegro/blob/master/src/main.zig</a><br />(also, it does have coroutines, so <a href="https://www.allegro.cc/forums/thread/618221">David will be happy</a>!)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Wed, 02 Sep 2020 01:06:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I have to say that I don&#39;t have a good reason to use C or C++ for personal projects anymore. </p><p>C   --&gt; Zig<br />C++ --&gt; D</p><p>The massive improvements with Zig is that it&#39;s harder to accidentally create some classes of bugs. E.g. many buffer or integer overflow bugs are caught at compile time.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Bob)</author>
		<pubDate>Wed, 02 Sep 2020 06:33:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Good to hear you&#39;ve been working with Zig. I found it a bit tricky as the docs are not great and it&#39;s still being changed frequently. For example it&#39;s not possible to pass or return <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_COLOR"><span class="a">ALLEGRO_COLOR</span></a></span> by value because of some limitations in the compiler which are due to be fixed in the future. I suspect in my zig code  I&#39;ve done things which are weird just because I wasn&#39;t sure of the optimal way to do them.<br />I don&#39;t know Rust but I think the zig syntax bears a superficial resemblance to it, what do you think?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Wed, 02 Sep 2020 14:46:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve only written trivial programs in Zig (basically, the examples in the website to get a feel for the language). So my experience is very limited.</p><p>I typically use D or Python by default now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Bob)</author>
		<pubDate>Wed, 02 Sep 2020 19:41:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think Zig is the first C replacer that actually convinces me. I should test it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Niunio)</author>
		<pubDate>Thu, 03 Sep 2020 14:52:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/618226/1047158#target">Peter Hull</a> said:</div><div class="quote"><p> (also, it does have coroutines, so David will be happy!)</p></div></div><p><img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=";D" border="0" />!! I haven&#39;t heard of Zig before, I&#39;ll have to check it out! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (David Couzelis)</author>
		<pubDate>Thu, 10 Sep 2020 21:27:25 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Zig is love, Zig is life. Wren is kinda also the same, but I always use C, it&#39;s my Goto unless I can&#39;t think of a solution in C and I have to choose the wicked C++. Even then I don&#39;t easily go for Zig and other languages for some reason.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Doctor Cop)</author>
		<pubDate>Fri, 11 Sep 2020 20:02:52 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I prefer Zag. You know, to keep &#39;em guessing.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sat, 12 Sep 2020 00:53:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ve never heard of Zig before. That&#39;s exciting! <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=":D" /></p><p>Though I already think of Rust as a C killer. And it is pretty neat too.</p><p>I hope people have interoperability on their radar so that code written in one is linkable and callable from another. Just to save on the square wheels.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Sat, 12 Sep 2020 09:57:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, you can call C functions from Zig out-of-the-box, but what about the other way? I mean call Zig functions from C (or other language).  Didn&#39;t found information about it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Niunio)</author>
		<pubDate>Sat, 12 Sep 2020 14:46:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s this section:<br /><a href="https://ziglang.org/#Export-functions-variables-and-types-for-C-code-to-depend-on">Export functions, variables, and types for C code to depend on</a></p><p>For example, in my conversion of ex_blit to zig mentioned above, I have <a href="https://github.com/pedro-w/zigallegro/blob/54b697e5f39cd262915e7cb41832db8231d8209d/src/main.zig#L200-L203">here</a>
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">export</span> fn user_main<span class="k2">(</span>argc: c_int, argv: <span class="k2">[</span><span class="k3">*</span>c<span class="k2">]</span><span class="k2">[</span><span class="k3">*</span>c<span class="k2">]</span>u8<span class="k2">)</span> c_int <span class="k2">{</span>
    <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>a5.shim_init<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
        abort_example<span class="k2">(</span><span class="s">"Could not init Allegro.\n"</span><span class="k2">)</span><span class="k2">;</span>
    <span class="k2">}</span>
...
</pre></div></div><p>
which is called by <span class="source-code"><a href="http://www.allegro.cc/manual/al_run_main"><span class="a">al_run_main</span></a></span> (a C function) from Zig&#39;s own main. The signature of that function is the Zig equivalent of <span class="source-code"><span class="k1">int</span> user_main<span class="k2">(</span><span class="k1">int</span> argc, <span class="k1">char</span><span class="k3">*</span> argv<span class="k2">[</span><span class="k2">]</span><span class="k2">)</span></span> which will be familiar to you.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Hull)</author>
		<pubDate>Sat, 12 Sep 2020 19:41:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Cute, another garbage language that mimics C and creates a cool name for the language. Another for the landfill.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (RmBeer2)</author>
		<pubDate>Mon, 14 Sep 2020 13:18:07 +0000</pubDate>
	</item>
</rss>
