<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>new forum noob</title>
		<link>http://www.allegro.cc/forums/view/612570</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 13 May 2013 03:20:33 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>hello my gamername is lethal_beast i am 15 years old, i love gaming (sometimes programming). the game i play most of the time is cod4<br />i am fairly new to programming apart from knowing some basics of c++ (still not really good). i started this weekend with installing allegro, reading the wiki and trying to understand the code.<br />here is a question:</p><p>in the following code (copied from wiki) i cant remove the first if statement(  if(!al_init())  )  why is that i thought the if (!....) was for checking if something works so you can display the error when it doesn&#39;t works.</p><p>i can remove the if(!display) though.</p><p>#include &lt;stdio.h&gt;<br />#include &lt;allegro5/allegro.h&gt;<br /> <br />int main(int argc, char **argv){<br /> <br />   ALLEGRO_DISPLAY *display = NULL;<br /> <br />   if(!al_init()) {<br />      fprintf(stderr, &quot;failed to initialize allegro!\n&quot;);<br />      return -1;<br />   }<br /> <br />   display = al_create_display(640, 480);<br />   if(!display) {<br />      fprintf(stderr, &quot;failed to create display!\n&quot;);<br />      return -1;<br />   }<br /> <br />   al_clear_to_color(al_map_rgb(0,0,0));<br /> <br />   al_flip_display();<br /> <br />   al_rest(10.0);<br /> <br />   al_destroy_display(display);<br /> <br />   return 0;<br />}
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (lethal_beast)</author>
		<pubDate>Sun, 12 May 2013 01:50:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><span class="source-code"><a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span></span> needs to be called to call most allegro functions. If you want to skip the check (but why would you? checking for errors is a good thing!), just remove the `if(! )` and the `{}` block below it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 12 May 2013 02:01:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ty for the help <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />the reason why i am asking this is because i want to understand which parts run the program and which parts are only optional.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (lethal_beast)</author>
		<pubDate>Sun, 12 May 2013 02:12:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The only thing you do not really need is the al_rest call. This will make everything pause for 10 seconds.</p><p>You may also want to look at other al_init_* functions because they are needed for sound, gamepad,ttf text drawing, and more.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Sun, 12 May 2013 02:30:52 +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/612570/982573#target">jmasterx</a> said:</div><div class="quote"><p>The only thing you do not really need is the al_rest call. This will make everything pause for 10 seconds.</p></div></div><p>It&#39;s there so the window doesn&#39;t close right away <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>It&#39;s a very basic example from the wiki.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 12 May 2013 02:40:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In programming, <i>everything</i> is mandatory. The biggest &quot;optional&quot; stuff you can possibly get is omitting explicitly setting up values that already set by default if they satisfy you. However, you shouldn&#39;t rely on that things will work on their own, so explicitly stating virtually everything is not only a good practice, but also a failsafe from unexpected behavior in underlying system.</p><p>------</p><p>Also, since you&#39;re only learning, I suggest you to use C rather than C++. It&#39;s (vastly) easier to learn and to work with, which is a big deal for you right now. (Not that simplicity is a bad thing: C++ is overcomplicated lightyears over the top, and all of the complexity hardly gives any benefits while certainly making your life harder.) Examples are written in C, too, which is another reason for you to use it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Sun, 12 May 2013 02:59:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i will start looking up some c tutorials from youtube and internet.<br />if have any tips about learning C certain tutorials,videos or maybe a book please post.<br />what is the biggest difference between C and C++?<br />allegro runs on C and C++?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (lethal_beast)</author>
		<pubDate>Sun, 12 May 2013 03:31:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>C is, for the most part (that has changed a bit since c++11, and c99, there are more differences between the two than there were) a subset of C++. C doesn&#39;t have classes, exceptions, or templates. C is procedural programming at its finest.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 12 May 2013 03:36:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In brief:</p><p>C</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="k1">struct</span> Player
<span class="number">  2</span><span class="k2">{</span>
<span class="number">  3</span>  <span class="k1">int</span> x<span class="k2">;</span>
<span class="number">  4</span>  <span class="k1">int</span> y<span class="k2">;</span>
<span class="number">  5</span><span class="k2">}</span><span class="k2">;</span>
<span class="number">  6</span>
<span class="number">  7</span><span class="k1">void</span> init_player<span class="k2">(</span>Player<span class="k3">*</span> player<span class="k2">)</span>
<span class="number">  8</span><span class="k2">{</span>
<span class="number">  9</span>   player-&gt;x <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 10</span>   player-&gt;y <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 11</span><span class="k2">}</span>
<span class="number"> 12</span>
<span class="number"> 13</span><span class="k1">void</span> move_player<span class="k2">(</span>Player<span class="k3">*</span> player, <span class="k1">int</span> dx, <span class="k1">int</span> dy<span class="k2">)</span>
<span class="number"> 14</span><span class="k2">{</span>
<span class="number"> 15</span>   player-&gt;x <span class="k3">+</span><span class="k3">=</span> dx<span class="k2">;</span>
<span class="number"> 16</span>   player-&gt;y <span class="k3">+</span><span class="k3">=</span> dy<span class="k2">;</span>
<span class="number"> 17</span><span class="k2">}</span>
</div></div><p>

C++
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="k1">class</span> Player
<span class="number">  2</span><span class="k2">{</span>
<span class="number">  3</span>  public:
<span class="number">  4</span>   Player<span class="k2">(</span><span class="k2">)</span>
<span class="number">  5</span>    <span class="k2">:</span> x<span class="k2">(</span><span class="n">0</span><span class="k2">)</span>, y<span class="k2">(</span><span class="n">0</span><span class="k2">)</span>
<span class="number">  6</span>    <span class="k2">{</span>
<span class="number">  7</span>      
<span class="number">  8</span>    <span class="k2">}</span>
<span class="number">  9</span>   <span class="k1">void</span> move<span class="k2">(</span><span class="k1">int</span> dx, <span class="k1">int</span> dy<span class="k2">)</span>
<span class="number"> 10</span>   <span class="k2">{</span>
<span class="number"> 11</span>     this-&gt;x <span class="k3">+</span><span class="k3">=</span> dx<span class="k2">;</span>
<span class="number"> 12</span>     this-&gt;y <span class="k3">+</span><span class="k3">=</span> dy<span class="k2">;</span>
<span class="number"> 13</span>   <span class="k2">}</span>
<span class="number"> 14</span>  private:
<span class="number"> 15</span>   <span class="k1">int</span> x<span class="k2">;</span>
<span class="number"> 16</span>   <span class="k1">int</span> y<span class="k2">;</span>
<span class="number"> 17</span><span class="k2">}</span>
<span class="number"> 18</span>
<span class="number"> 19</span>...
<span class="number"> 20</span>Player player<span class="k2">;</span>
<span class="number"> 21</span>player.move<span class="k2">(</span><span class="n">5</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Sun, 12 May 2013 03:46:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>C is not a subset of C++, because C++ can&#39;t compile C code. Technically, you <i>could</i> force it to do so using specifically coded programs, but that&#39;s not valid argument. </p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612570/982582#target">lethal_beast</a> said:</div><div class="quote"><p> allegro runs on C and C++?
</p></div></div><p>Allegro runs on C.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> what is the biggest difference between C and C++?
</p></div></div><p>As opposed to C++, C lacks of syntax sugar. That&#39;s about it. They do everything similarry and capabilities are exactly the same, but C does it straightforward while C++ uses complicated and (for the most part) confusing patterns.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> any tips about learning C certain tutorials
</p></div></div><p><a href="http://www.cprogramming.com/tutorial/c/lesson1.html">http://www.cprogramming.com/tutorial/c/lesson1.html</a></p><p>Just make sure you don&#39;t treat programming as magical stuff that you &quot;copy from a book and then it works&quot;. All there is to program execution is juggling bytes, numbers. Everything is the number, one way or another.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Sun, 12 May 2013 04:00:46 +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/612570/982582#target">lethal_beast</a> said:</div><div class="quote"><p>
what is the biggest difference between C and C++?
</p></div></div><p>
C has terrible support for object oriented programming, while its baked into C++. If you are getting started you may not want to deal with OOP just yet, but when you are, don&#39;t do it in C.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
allegro runs on C and C++?
</p></div></div><p>
You&#39;re really asking which language should you use with Allegro. You can use either C or C++, its the same.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Sun, 12 May 2013 04:06:55 +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/612570/982585#target">Raidho36</a> said:</div><div class="quote"><p> They do everything similarry and capabilities are exactly the same, but C does it straightforward while C++ uses complicated and (for the most part) confusing patterns.</p></div></div><p>Having done a lot of OOP, I&#39;d feel closer to the opposite. C++ uses straightforward patterns (except for the whole header/source separation, but C has that problem too), but C makes you jump through unnecessary hoops.</p><p>It really just depends on what you&#39;re comfortable with and what you want to do, though. I&#39;d probably recommend C++ over C if only for the fact that it&#39;s more similar to the other currently popular languages than C is.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jeff Bernard)</author>
		<pubDate>Sun, 12 May 2013 05:07:12 +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/612570/982585#target">Raidho36</a> said:</div><div class="quote"><p>C is not a subset of C++, because C++ can&#39;t compile C code</p></div></div><p>Code 100% standard c89, and any decent C++ compiler can compile it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 12 May 2013 05:45:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Everyone knows this one:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">typedef</span> <span class="k1">int</span> foo<span class="k2">;</span>
<span class="k1">struct</span> foo <span class="k2">{</span> <span class="k1">int</span> x<span class="k2">;</span> <span class="k2">}</span><span class="k2">;</span>
</pre></div></div><p>

I was surprised by this one: (technically it <b>compiles</b>)
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"%d\n"</span>, <span class="k1">sizeof</span><span class="k2">(</span><span class="s">'a'</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Sun, 12 May 2013 06:39:09 +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/612570/982601#target">Peter Wang</a> said:</div><div class="quote"><p>typedef int foo;<br />struct foo { int x; };</p></div></div><p>I can&#39;t say I&#39;ve seen that. Or considered it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 12 May 2013 06:46:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Also: <a href="http://codepad.org/WbNYNpLM">Works in C</a>, but <a href="http://codepad.org/dWqV4Gjv">not as C++</a><sup>[1]</sup>. Or even <a href="http://codepad.org/AULlrv8r">this works in C</a>, but <a href="http://codepad.org/brLQVkYJ">not in C++</a><sup>[2]</sup>.</p><p><a href="http://www.parashift.com/c++-faq-lite/back-compat-with-c.html">Is C++ backwards compatible with C?</a></p><p>For all in-tents and purposes, I&#39;d agree that C is a subset of C++. If your C program isn&#39;t compilable as C++, it&#39;s probably poorly written. The second example I posted may have it&#39;s uses, but it&#39;s a fairly trivial fix, plus I think most people write prototypes anyway.</p><p>--------------------------------------------<br />Appendix: Valid C, but invalid C++:</p><div class="source-code snippet"><div class="inner"><pre><span class="c">//[1]</span>
<span class="k1">void</span> foo<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"ok\n"</span><span class="k2">)</span><span class="k2">;</span> <span class="k2">}</span>

<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
   foo<span class="k2">(</span><span class="n">1</span>, <span class="n">2</span>, <span class="n">3</span>, <span class="n">4</span>, <span class="n">5</span><span class="k2">)</span><span class="k2">;</span>
   <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

</p><div class="source-code snippet"><div class="inner"><pre><span class="c">//[2]</span>
<span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span>
   foo<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
   <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="k2">}</span>

<span class="k1">void</span> foo<span class="k2">(</span><span class="k2">)</span> <span class="k2">{</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_624.html" target="_blank">printf</a><span class="k2">(</span><span class="s">"ok\n"</span><span class="k2">)</span><span class="k2">;</span> <span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jeff Bernard)</author>
		<pubDate>Sun, 12 May 2013 07:02:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh fine. I did say &quot;for the most part&quot;. Many of the things that don&#39;t work in C++ that do in C, you probably shouldn&#39;t do normally anyhow.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 12 May 2013 07:08:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I do normally cast pointer types, in my data structures handling. You wouldn&#39;t write it&#39;s own stack implementation for every possible data type, would you? Provided typecasting and pointer math hardly (if any) takes more processing than direct approach. And silly C++ with it&#39;s silly restrictions will complain about casting issues so hard that the code won&#39;t work. Way to go simplicity, Jeff.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/612570/982601#target">Peter Wang</a> said:</div><div class="quote"><p> I was surprised by this one: (technically it compiles)
</p></div></div><p>What makes any surprise to you? <span class="source-code"><span class="s">'X'</span></span> would be a <span class="source-code"><span class="k1">char</span></span> constant, what&#39;s confusing with getting size of a <span class="source-code"><span class="k1">char</span></span> constant?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Sun, 12 May 2013 11:25:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Then I think you&#39;ll be surprised as well.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Sun, 12 May 2013 13:15:21 +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/612570/982609#target">Raidho36</a> said:</div><div class="quote"><p> <span class="source-code"><span class="s">'X'</span></span> would be a <span class="source-code"><span class="k1">char</span></span> constant, what&#39;s confusing with getting size of a <span class="source-code"><span class="k1">char</span></span> constant?</p></div></div><p>For some reason, <span class="source-code"><span class="s">'X'</span></span> is an <span class="source-code"><span class="k1">int</span></span> constant in C. <img src="http://www.allegro.cc/forums/smileys/shocked.gif" alt=":o" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jeff Bernard)</author>
		<pubDate>Sun, 12 May 2013 14:19:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><b>Back on topic</b> i.e. relevant to the original poster <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>What you&#39;ve done is found your first example of code that isn&#39;t written as intuitively as it could be.</p><p>To explain, the way &#39;if (A) B&#39; works is:
</p><ol><li><p>Execute A.
</p></li><li><p>If the result was true / nonzero / non-null, then execute B.</p></li></ol><p>There are two ways of approaching this. Some people always try to make sure A has no side-effects and is (as you expected) merely a check.[1] Other people expect that everyone understands the subtleties of &#39;if&#39;, and will happily set the condition (A) to an important command that must be executed, and then check its result using the surrounding &#39;if&#39; construct.</p><p>The first approach does lead to more verbose code that takes a bit longer to write, but it also makes your kind of misunderstanding less likely. This is a trivial example and one you&#39;ll get used to quickly, but there are lots and lots of other ways programmers can confuse each other, many of them far harder to figure out <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>Hope that all makes sense <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>[1]<br />[EDIT] Added this footnote. Here&#39;s an example of how such people would write the above code:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">bool</span> succeeded <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="k1">if</span><span class="k2">(</span><span class="k3">!</span>succeeded<span class="k2">)</span> <span class="k2">{</span>
  <a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a><span class="k2">(</span>stderr, <span class="s">"failed to initialize allegro!\n"</span><span class="k2">)</span><span class="k2">;</span>
  <span class="k1">return</span> <span class="k3">-</span><span class="n">1</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
(Note &#39;bool&#39; is C++ - in C it won&#39;t work and you&#39;ll have to write &#39;int&#39;.)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Bruce Perry)</author>
		<pubDate>Sun, 12 May 2013 16:00:11 +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/612570/982610#target">Peter Wang</a> said:</div><div class="quote"><p> Then I think you&#39;ll be surprised as well.
</p></div></div><p>Well, it did treated it as an <span class="source-code"><span class="k1">unsigned</span> <span class="k1">int</span></span>. This is not entirely what I expected, but it&#39;s still perfectly reasonable: unless you trying to save space, you choose an <span class="source-code"><span class="k1">int</span></span>, because it would perfectly fit the register, naturally keeps byte alignment and the bus will probably fetch it faster from RAM. Since this letter would end up directly in registers, there&#39;s no need to save space whatsoever, so it&#39;s 4 bytes. Also, it allows using unicode characters rather than ASCII characters.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Sun, 12 May 2013 17:01:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>For bool in C, shouldn&#39;t char be used instead of int? Why use 4 bytes when you can use 1.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jmasterx)</author>
		<pubDate>Sun, 12 May 2013 17:03:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>C doesn&#39;t define boolean type. The <span class="source-code"><span class="k1">if</span></span> block only recognizes zero and non-zero value. You could use <span class="source-code"><span class="k1">char</span></span> for bool as well as <span class="source-code"><span class="k1">int</span></span>, you could as well use bithacks to place 8 booleans into a single <span class="source-code"><span class="k1">char</span></span>. Myself, I hardly ever use booleans. Instead, I use <span class="source-code"><span class="k1">goto</span></span> jumps, which is the basic reason for most people to even use booleans - to avoid gotos because &quot;they&#39;re bad&quot; and &quot;you can&#39;t use them&quot;. ------ But when I do, it&#39;s an <span class="source-code"><span class="k1">int</span></span> bitfield.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Sun, 12 May 2013 17:27:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>@jmasterx: the registers are 4- or 8-byte and often for the computations chars, shorts etc. will be converted up to the architecture dependent size. If it makes any difference at all, any type smaller than the machine word will be slower to handle, however if you store lots of such values, the size gain factor of 4 or 8 may turn out relevant. In the general case it&#39;s not.</p><p>@Raidho36: note that C99 adds &lt;stdbool.h&gt;. It&#39;s not built into the language, but it&#39;s standard and should be portable (if you use code that already messes with redefining of the &quot;true&quot;, &quot;false&quot; or &quot;bool&quot; symbols, you may run into surprises).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Anton Chigurh)</author>
		<pubDate>Mon, 13 May 2013 02:31:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah I know, but I don&#39;t use C99. It doesn&#39;t have anything I&#39;d wanted to have over default feature set. Also I don&#39;t mess with those values, I simply use whatever is capable of evaluating into zero and nonzero when I need it to. And as I already mentioned, I hardly ever need a boolean type and when I do for the most part I only use boolean values as a part of bitfields.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Raidho36)</author>
		<pubDate>Mon, 13 May 2013 03:09:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>K&amp;R shake their beards with approval, and I too think this is the proper way of doing stuff in C. That was just some useless knitpicking ;-)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Anton Chigurh)</author>
		<pubDate>Mon, 13 May 2013 03:20:33 +0000</pubDate>
	</item>
</rss>
