<?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>syntax | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/category/syntax/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>Wed, 29 Apr 2020 21:47:11 +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>syntax | 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>1566 Compile errors with just two characters!</title>
		<link>https://learncgames.com/1566-compile-errors-with-just-two-characters/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=1566-compile-errors-with-just-two-characters</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sun, 10 May 2020 23:00:50 +0000</pubDate>
				<category><![CDATA[bugs]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[compile errors]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=560</guid>

					<description><![CDATA[<p>When programmers have to explain why it took longer to get something working,you don&#8217;t often here reasons like this. A simple syntax error error took me an hour to find and fix. Yet it does happen and it happened to me today. Oh sure you feel silly afterwards and it was only a 131 lines [&#8230;]</p>
The post <a href="https://learncgames.com/1566-compile-errors-with-just-two-characters/">1566 Compile errors with just two characters!</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignleft size-full wp-image-561" src="https://learncgames.com/wp-content/uploads/2020/04/1566-compile-errors.png" alt="1500 compile errors" width="692" height="295" srcset="https://learncgames.com/wp-content/uploads/2020/04/1566-compile-errors.png 692w, https://learncgames.com/wp-content/uploads/2020/04/1566-compile-errors-300x128.png 300w" sizes="(max-width: 692px) 100vw, 692px" />When programmers have to explain why it took longer to get something working,you don&#8217;t often here reasons like this. A simple syntax error error took me an hour to find and fix. Yet it does happen and it happened to me today.</p>
<p>Oh sure you feel silly afterwards and it was only a 131 lines of C code. The very last of the 1566 compile errors was unexpected end-of-file found on line 132. That was a red herring of sorts. The error actually occurred right at the start of the program.</p>
<p>Here&#8217;s the first 10 lines. It should be quite easy to spot but when you are looking through 130 lines with a hint that it&#8217;s messed up the end of the file, it&#8217;s not so obvious.</p>
<pre><code class="language-c" data-line="">// tictactoe.c
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string&gt;
#include &lt;time.h&gt;

int playerIsX, computerFirst, x, y, danger, turn;
char board[3][3];  // holds X, O and space
char playerPiece, computerPiece;</code></pre>
<p>In case you haven&#8217;t spotted it, it&#8217;s the missing .h; it should be string.h not string in that 3rd #include. An obvious-in-hindsight clue is the error listing. The files that are mentioned don&#8217;t have .h on them.  (cctype, cstdint etc. Those are C++ files and string is a C++ header file. Also mention of namespace in the error message is also a big hint.</p>
<p>Still I think that sets a record for the most errors generated in a C compile! The compiler btw was Visual Studio 2019&#8217;s C/C++ compiler.</p>The post <a href="https://learncgames.com/1566-compile-errors-with-just-two-characters/">1566 Compile errors with just two characters!</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">560</post-id>	</item>
		<item>
		<title>Another Windows vs Linux Difference</title>
		<link>https://learncgames.com/another-windows-vs-linux-difference/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=another-windows-vs-linux-difference</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sun, 05 Apr 2020 23:00:34 +0000</pubDate>
				<category><![CDATA[Source code]]></category>
		<category><![CDATA[syntax]]></category>
		<category><![CDATA[byte]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=315</guid>

					<description><![CDATA[<p>Once I reached the masks section in chapter 38, I found my C code that I&#8217;d copied from Windows failed because of the type byte. MSVC is a little bit more forgiving over somethings and one of those is the byte type which it accepts.  In the Windows code, I had declared the mask arrays [&#8230;]</p>
The post <a href="https://learncgames.com/another-windows-vs-linux-difference/">Another Windows vs Linux Difference</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<figure id="attachment_317" aria-describedby="caption-attachment-317" style="width: 300px" class="wp-caption alignleft"><img decoding="async" class="size-medium wp-image-317" src="https://learncgames.com/wp-content/uploads/2020/03/Byte45flip-300x129.png" alt="Bytes" width="300" height="129" srcset="https://learncgames.com/wp-content/uploads/2020/03/Byte45flip-300x129.png 300w, https://learncgames.com/wp-content/uploads/2020/03/Byte45flip.png 454w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-317" class="wp-caption-text">Image From Wikimedia Commons</figcaption></figure>
<p>Once I reached the masks section in chapter 38, I found my C code that I&#8217;d copied from Windows failed because of the type byte. MSVC is a little bit more forgiving over somethings and one of those is the byte type which it accepts.  In the Windows code, I had declared the mask arrays like this:</p>
<pre><code class="language-c" data-line="">byte bulletmask[1][3][3];
byte plmask[24][64][64];
byte a1mask[24][280][280];
byte a2mask[24][140][140]; 
byte a3mask[24][70][70];
byte a4mask[24][35][35];
</code></pre>
<p>But Clang in its wisdom barfed at that, not recognising the type byte. A simple fix was replace byte with char and all was well.</p>
<p>Looking into it, I loaded one of the Windows asteroids projects, built it and then did a ctrl-click on the <em>byte</em> type. It led me to a file called rpcndr.h in a Windows SDK folder and this line (191) of code.</p>
<pre><code class="language-c" data-line="">typedef unsigned char byte;</code></pre>
<p>It just shows!  My er bad&#8230;</p>The post <a href="https://learncgames.com/another-windows-vs-linux-difference/">Another Windows vs Linux Difference</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">315</post-id>	</item>
	</channel>
</rss>
