<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[LastCode.net - All Forums]]></title>
		<link>http://lastcode.net/</link>
		<description><![CDATA[LastCode.net - http://lastcode.net]]></description>
		<pubDate>Sun, 05 Sep 2010 01:23:15 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[[MyBB Plugin&#93; HTML for Admins UPDATE!]]></title>
			<link>http://lastcode.net/showthread.php?tid=120</link>
			<pubDate>Tue, 24 Aug 2010 04:58:27 -0500</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=120</guid>
			<description><![CDATA[For anyone wanting this plugin, please go to:<br />
<a href="http://shopmybb.com/item/usergroups-html/8" target="_blank">http://shopmybb.com/item/usergroups-html/8</a><br />
<br />
Anman told me to post this and seeing how the original thread is locked, I made a new one.]]></description>
			<content:encoded><![CDATA[For anyone wanting this plugin, please go to:<br />
<a href="http://shopmybb.com/item/usergroups-html/8" target="_blank">http://shopmybb.com/item/usergroups-html/8</a><br />
<br />
Anman told me to post this and seeing how the original thread is locked, I made a new one.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Pushing an element into associative array?]]></title>
			<link>http://lastcode.net/showthread.php?tid=119</link>
			<pubDate>Sun, 01 Aug 2010 12:45:18 -0500</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=119</guid>
			<description><![CDATA[Title says it. How would I accomplish this?<br />
Preferably as fast as possible.<br />
<br />
<img src="http://lastcode.net/images/smilies/CrystalXP/great.gif" style="vertical-align: middle;" border="0" alt="Thumbs up" title="Thumbs up" /><br />
<br />
Edit:<br />
Something like <br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">php</span>&nbsp;Code:</div><div class="body"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://www.php.net/array_push"><span style="color: #990000;">array_push</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;key&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;data&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div><br />
<br />
Edit 2: Problem fixed. <img src="http://lastcode.net/images/smilies/CrystalXP/biggrin.gif" style="vertical-align: middle;" border="0" alt="Biggrin" title="Biggrin" />]]></description>
			<content:encoded><![CDATA[Title says it. How would I accomplish this?<br />
Preferably as fast as possible.<br />
<br />
<img src="http://lastcode.net/images/smilies/CrystalXP/great.gif" style="vertical-align: middle;" border="0" alt="Thumbs up" title="Thumbs up" /><br />
<br />
Edit:<br />
Something like <br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">php</span>&nbsp;Code:</div><div class="body"><pre class="php" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><a href="http://www.php.net/array_push"><span style="color: #990000;">array_push</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data2</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;key&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;data&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li></ol></pre></div></div><br />
<br />
Edit 2: Problem fixed. <img src="http://lastcode.net/images/smilies/CrystalXP/biggrin.gif" style="vertical-align: middle;" border="0" alt="Biggrin" title="Biggrin" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Which Renders Faster?]]></title>
			<link>http://lastcode.net/showthread.php?tid=117</link>
			<pubDate>Wed, 21 Jul 2010 18:40:52 -0500</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=117</guid>
			<description><![CDATA[Well, in the ultimate goal of speed optimization, I have to ask: Which renders faster? &lt;div&gt; or &lt;table&gt; elements?<br />
<br />
Of course, each would be styled (sometimes heavily), with the &lt;div&gt;s being styled to act like tables.<br />
<br />
If nobody knows, is there a way to benchmark them both?]]></description>
			<content:encoded><![CDATA[Well, in the ultimate goal of speed optimization, I have to ask: Which renders faster? &lt;div&gt; or &lt;table&gt; elements?<br />
<br />
Of course, each would be styled (sometimes heavily), with the &lt;div&gt;s being styled to act like tables.<br />
<br />
If nobody knows, is there a way to benchmark them both?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Inactivity]]></title>
			<link>http://lastcode.net/showthread.php?tid=115</link>
			<pubDate>Thu, 15 Jul 2010 15:02:29 -0500</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=115</guid>
			<description><![CDATA[I apologize for my inactivity for those of you that still check this site faithfully.<br />
<br />
Between my business and my blog I've been quite busy these days - but I haven't forgot about this site.<br />
<br />
I hope to be more active in the future, thank you to all of you who have stayed.]]></description>
			<content:encoded><![CDATA[I apologize for my inactivity for those of you that still check this site faithfully.<br />
<br />
Between my business and my blog I've been quite busy these days - but I haven't forgot about this site.<br />
<br />
I hope to be more active in the future, thank you to all of you who have stayed.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Calculator]]></title>
			<link>http://lastcode.net/showthread.php?tid=113</link>
			<pubDate>Fri, 19 Mar 2010 11:07:12 -0500</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=113</guid>
			<description><![CDATA[I made a <span style="font-weight: bold;">very</span> simple calculator program based on the CodeIgniter framework, as a test figuring out how to work with the framework.<br />
<br />
If you find any bugs please tell me.<br />
<br />
<a href="http://labs.lastcode.net/calc/" target="_blank">Check it out!</a>]]></description>
			<content:encoded><![CDATA[I made a <span style="font-weight: bold;">very</span> simple calculator program based on the CodeIgniter framework, as a test figuring out how to work with the framework.<br />
<br />
If you find any bugs please tell me.<br />
<br />
<a href="http://labs.lastcode.net/calc/" target="_blank">Check it out!</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[AnLib]]></title>
			<link>http://lastcode.net/showthread.php?tid=112</link>
			<pubDate>Thu, 11 Mar 2010 19:08:24 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=112</guid>
			<description><![CDATA[AnLib is a library of PHP classes I have created to help create and deploy PHP applications swiftly. It is still in alpha stages.<br />
<br />
<a href="http://sourceforge.net/projects/anlib" target="_blank">Get it on Sourceforge</a>.]]></description>
			<content:encoded><![CDATA[AnLib is a library of PHP classes I have created to help create and deploy PHP applications swiftly. It is still in alpha stages.<br />
<br />
<a href="http://sourceforge.net/projects/anlib" target="_blank">Get it on Sourceforge</a>.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[PHPLiveX]]></title>
			<link>http://lastcode.net/showthread.php?tid=111</link>
			<pubDate>Sun, 07 Mar 2010 06:47:17 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=111</guid>
			<description><![CDATA[Just stumbled across this awesome tool for PHP developers. PHPLiveX allows you to call PHP functions through JavaScript.<br />
<br />
To find out more and download it, visit the <a href="http://www.phplivex.com/" target="_blank">website</a>.]]></description>
			<content:encoded><![CDATA[Just stumbled across this awesome tool for PHP developers. PHPLiveX allows you to call PHP functions through JavaScript.<br />
<br />
To find out more and download it, visit the <a href="http://www.phplivex.com/" target="_blank">website</a>.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Just some questions.]]></title>
			<link>http://lastcode.net/showthread.php?tid=110</link>
			<pubDate>Sat, 20 Feb 2010 22:50:31 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=110</guid>
			<description><![CDATA[Hello, I briefly mentioned my dad's business in another post of mine.  Well he runs a water business, Clear Water Plus, where he provides purified water and the likes.  He has people purchase pre-paid water cards which he keeps the physical cards and marks them off as people use the gallons.  In my college course, we were just getting into inputing and storing phone book data, phone numbers and names etc and then searching and referencing them back.  I was going to take that knowledge and tweak it into a program for him to store the water card information and look it up on his computer instead of digging through hundreds of cards on a daily basis.  I didn't get that far however.  I was wondering if C++ is my best viable option for that type of program.  I was going to have him use an excel sheet, but he is very computer illiterate and he kept somehow managing to not save/delete stuff while attempting to search and the spread sheet.  So a program is a more viable option considering input control and user friendliness.  <br />
<br />
  I just wanted to know, if anybody could give me a head start link to the basics I would need to create the simple program and get it functioning in a user-friendly format for him.  I'm sure I could find plenty of guides for this type of stuff if I ran over to google, but I like this site and am trying to encourage it's activity.  One major reason also, is I'm not sure C++ is my best choice, because I would like to eventually adapt the program into a web interface for him, so people could purchase/charge their water cards online.  Databasing, security, and encryption can be terribly nasty though, so I'm assuming the best solution to this would be to just find a free or relatively cheap shopping cart system that has the functionality for a water card set up.  Amount of gallons someone has and how to recharge them, I know some of those shopping cart systems have something like a variable item of quantity.  The only issue then would be my dad easily accessing this information, and deducting the gallons as they're used in the store.  <br />
<br />
If any of you have any thoughts/suggestions, I would really really appreciate it.  Thanks for your time.  <img src="http://lastcode.net/images/smilies/CrystalXP/great.gif" style="vertical-align: middle;" border="0" alt="Thumbs up" title="Thumbs up" />]]></description>
			<content:encoded><![CDATA[Hello, I briefly mentioned my dad's business in another post of mine.  Well he runs a water business, Clear Water Plus, where he provides purified water and the likes.  He has people purchase pre-paid water cards which he keeps the physical cards and marks them off as people use the gallons.  In my college course, we were just getting into inputing and storing phone book data, phone numbers and names etc and then searching and referencing them back.  I was going to take that knowledge and tweak it into a program for him to store the water card information and look it up on his computer instead of digging through hundreds of cards on a daily basis.  I didn't get that far however.  I was wondering if C++ is my best viable option for that type of program.  I was going to have him use an excel sheet, but he is very computer illiterate and he kept somehow managing to not save/delete stuff while attempting to search and the spread sheet.  So a program is a more viable option considering input control and user friendliness.  <br />
<br />
  I just wanted to know, if anybody could give me a head start link to the basics I would need to create the simple program and get it functioning in a user-friendly format for him.  I'm sure I could find plenty of guides for this type of stuff if I ran over to google, but I like this site and am trying to encourage it's activity.  One major reason also, is I'm not sure C++ is my best choice, because I would like to eventually adapt the program into a web interface for him, so people could purchase/charge their water cards online.  Databasing, security, and encryption can be terribly nasty though, so I'm assuming the best solution to this would be to just find a free or relatively cheap shopping cart system that has the functionality for a water card set up.  Amount of gallons someone has and how to recharge them, I know some of those shopping cart systems have something like a variable item of quantity.  The only issue then would be my dad easily accessing this information, and deducting the gallons as they're used in the store.  <br />
<br />
If any of you have any thoughts/suggestions, I would really really appreciate it.  Thanks for your time.  <img src="http://lastcode.net/images/smilies/CrystalXP/great.gif" style="vertical-align: middle;" border="0" alt="Thumbs up" title="Thumbs up" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[guide&#93; Optimizations in your C++ Program]]></title>
			<link>http://lastcode.net/showthread.php?tid=109</link>
			<pubDate>Sat, 20 Feb 2010 22:29:14 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=109</guid>
			<description><![CDATA[Hi everyone.<br />
This is my very first real article on anything programming related, so bare with me.<br />
<br />
I'm not actually going to go too far into this, just going to bring up some small things that you can do to make your programs more efficient (sometimes slightly, other times greatly).<br />
<br />
Now, for those compiling with gcc, it's a pretty smart compiler, and it will most likely assume what you're trying to do, and correct it accordingly.  Though the same cannot be said about every compiler, or every version of every compiler; such as the while vs for (I'll get to that in a moment); I think microsoft and borland's compile it literally (optimization, aside).<br />
So it's better to be safe than sorry, especially if you don't know if your code will compiler on various platforms.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">while() vs for()</span></span><br />
<span style="font-style: italic;">NOTE:My compiler ended up auto-optimizing this, so I couldn't create some assembly code to match my argument (though you can google it up, and you'll find some code generated on other compilers which support this argument), but I can generate some assembly that would look similar, if you want</span>.<br />
<br />
There can be abit of controversy when it comes to for vs while for an infinite loop.<br />
In a literal compilation, while() and for() will not do the same thing.<br />
Consider the following two:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>while(1)<br />
&nbsp;&nbsp;std::cout&lt;&lt;"oh noes!"&lt;&lt;std::endl;<br />
for(;;)<br />
&nbsp;&nbsp;std::cout&lt;&lt;"oh noes!"&lt;&lt;std::endl;</code></div></div>
What the program may compile to in the first example (via pseudo-assembly) is:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">label<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Check <span style="color: #0000ff;">if</span> <span style="color: #FF0000;">'1'</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">print <span style="color: #FF0000;">&quot;oh noes!&quot;</span> endline</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">jump to <span style="color: #FF0000;">'label'</span></div></li></ol></pre></div></div><br />
Here's the second code:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000080;">&lt;</span>empty statement <span style="color: #000040;">--</span> <span style="color: #0000ff;">do</span> nothing<span style="color: #000080;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">label<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000080;">&lt;</span>empty statement <span style="color: #000040;">--</span> <span style="color: #0000ff;">do</span> nothing<span style="color: #000080;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">print <span style="color: #FF0000;">&quot;oh noes!&quot;</span> endline</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000080;">&lt;</span>empty statement <span style="color: #000040;">--</span> <span style="color: #0000ff;">do</span> nothing<span style="color: #000080;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">jump to <span style="color: #FF0000;">'label'</span></div></li></ol></pre></div></div><br />
Where you see "&lt;empty statement -- do nothing&gt;", that's actually where the two semi-colons for the for loop are.<br />
So in short..<br />
A while() loop, since it's conditional, will validate to make sure that the condition '1' is true, if so, it will continue the loop, whereas a for() statement would have no statement to condition, so it simply loops.<br />
One fun thing I like to do in my code, is this:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#define EVER ;;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>EVER<span style="color: #008000;">&#41;</span> <span style="color: #666666;">//muhaha!</span></div></li></ol></pre></div></div><br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Postfix vs Prefix operators</span></span><br />
One thing I see alot in code, is the use of 'var++' over '++var'.<br />
Protip: Unless you need the value of 'var' before incrementing it, use pre-incremental.<br />
You may think, "what harm can ++i do?".  Honestly, not that much, if it's just an integer.<br />
See, when you use ++i, it increments i, and returns it's value.  When you're using i++, it stores the value of i, increments it, and returns it's old value.<br />
In assembly, this is just switching of three commands, but what about with objects?<br />
A great example I found <a href="http://www.codeguru.com/forum/showthread.php?t=231052" target="_blank">here</a>, is the following:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">class</span> MyClass</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    MyClass<span style="color: #000040;">&amp;</span> operator<span style="color: #000040;">++</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>    <span style="color: #666666;">//Prefix increment operator  (++x)</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #666666;">//Perform increment operation</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">return</span> <span style="color: #000040;">*</span><span style="color: #0000dd;">this</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    MyClass  operator<span style="color: #000040;">++</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">&#41;</span> <span style="color: #666666;">//Postfix increment operator (x++)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        MyClass temp <span style="color: #000080;">=</span> <span style="color: #000040;">*</span><span style="color: #0000dd;">this</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #666666;">//Perform increment operation</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">return</span> temp<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></div></li></ol></pre></div></div><br />
As you see, a new object is initialized, holding the old object, and returns that object.<br />
This means that you're taking a performance shot to the stack every time you use postfix.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Dynamic allocation vs static (for lack of a better term) allocation.</span></span><br />
First off, let me define dynamic and static:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//static:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  object obj<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  foo <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  obj.<span style="color: #007788;">setValue</span><span style="color: #008000;">&#40;</span>foo<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//dynamic:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  object <span style="color: #000040;">*</span>obj <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> object<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> <span style="color: #000040;">*</span>foo <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> <span style="color: #0000ff;">int</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000040;">*</span>foo <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  obj<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>setValue<span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span>foo<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000dd;">delete</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000dd;">delete</span> obj<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666;">//Please excuse my dereferencing if it's wrong.</span></div></li></ol></pre></div></div><br />
Now, the primary difference between the dynamic and static, is that when you dynamically allocate data, it is saved in the heap; whereas if you statically allocate it, it is saved on the stack.<br />
So for large objects, it's a good idea to dynamically allocate it, to preserve the stack.<br />
Another benefit of dynamically allocated objects, is that they don't have to follow the law of scope, and in a sense, they never go out of scope until they are manually deleted.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Two-Dimensional Array Access</span></span><br />
Access wouldn't be the word -- I should say traverse a two-dimensional array.<br />
But the question is, which is better to use?<br />
ary[x&#93;[y&#93; or ary[y&#93;[x&#93;?<br />
<br />
It may not seem like there's any difference, but one is actually much slower than the other.<br />
Here's an example of what the array foo[3&#93;[3&#93; would look like in memory (don't question my epic pant skillz ;D):<br />
<img src="http://i49.tinypic.com/2qdslqv.png" border="0" alt="[Image: 2qdslqv.png&#93;" /><br />
Putting more into perspective, consider the two:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>x<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> x<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>x<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>y<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> y<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>y<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    foo<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>x<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> x<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>x<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>y<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> y<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>y<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    foo<span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li></ol></pre></div></div><br />
Here is what the first five steps of the first for/for loop is doing in memory:<br />
(the red dot represents where in memory the program is pointing to, and the arrow represents where that pointer is pointing to).<br />
<img src="http://i46.tinypic.com/wt8zgo.png" border="0" alt="[Image: wt8zgo.png&#93;" /><br />
As you can see, it's using the pointer foo[0&#93; to reach each location of memory that is next to it.<br />
Next, we look at the second part:<br />
<img src="http://i46.tinypic.com/2ewpgkw.png" border="0" alt="[Image: 2ewpgkw.png&#93;" /><br />
<br />
As you can see, the second way, the data pointer is throwing itself all over memory, instead of moving though it one block at a time.<br />
To prove it's length, here is a program I threw together (well, I modified it from the original C program my professor used last year) that creates an array that's 0xF00*0xF00 in size, and traverses it:<br />
<a href="http://pastebin.com/f45636265" target="_blank">http://pastebin.com/f45636265</a><br />
Here are the results for when I ran it:<br />
x-&gt;y: 0.0500<br />
y-&gt;x: 0.1000<br />
As expected, the latter was about half as slow.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">switch() vs else if</span></span><br />
I generated some assembly output for this one (I generated assembly output for the rest as well, but those aren't worth looking at).<br />
One thing I try to do, is use switch() as much as possible, as opposed to else if.<br />
Consider the following two programs:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> myVar <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span> 1<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">++</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span> 2<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  3<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">++</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  4<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">--</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  5<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  6<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x3</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  7<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  <span style="color: #000080;">&lt;</span>img src<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;http://lastcode.net/images/smilies/CrystalXP/glasses.gif&quot;</span> style<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;vertical-align: middle;&quot;</span> border<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;0&quot;</span> alt<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;Glasses&quot;</span> title<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;Glasses&quot;</span> <span style="color: #000040;">/</span><span style="color: #000080;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  9<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x2a</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  10<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x801</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  11<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x6</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  12<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xfa</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  13<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x0354</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  14<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span>myVar<span style="color: #000040;">+</span><span style="color: #0000dd;">8</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  15<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #0000dd;">415</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xF</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  foo <span style="color: #000080;">=</span> myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li></ol></pre></div></div><br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> myVar <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>myVar<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 1<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #000040;">++</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">case</span> 2<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 3<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">++</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 4<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">--</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 5<span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 6<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x3</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 7<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 8<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 9<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x2a</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 10<span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x801</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 11<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x6</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 12<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xfa</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 13<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x0354</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 14<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span>myVar<span style="color: #000040;">+</span><span style="color: #0000dd;">8</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 15<span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #0000dd;">415</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  foo <span style="color: #000080;">=</span> myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li></ol></pre></div></div><br />
The brackets are left out, as it would make the else if too long.<br />
Now, when this is compiled, the first program would end up compiling into a mess of cmp and jmp commands, one-by-one, working its way down.<br />
If myVar happened to be 15, it would end up doing 15 conditionals.  The worst-case scenario here, would be that myVar isn't a number listed, and the result would be a test of every possible condition, until it reaches the else.<br />
<br />
As for the switch(), that actually manages to be pretty efficient (well... VERY efficient).<br />
This is because the second will compile into jump tables -- or hash maps.  This means that there is only <span style="font-style: italic;">one</span> test done, and it knows which to jump to.<br />
You can find the assembly output for the first program here: <a href="http://pastebin.com/f511c7140" target="_blank">http://pastebin.com/f511c7140</a> and the second here: <a href="http://pastebin.com/f654d9226" target="_blank">http://pastebin.com/f654d9226</a><br />
<br />
We now have a situation though.  And that's the question of "what should we do with strings?".<br />
I ran into this exact problem when I was writing my virtual machine, well, more specifically, my assembler.<br />
In my first version, I was using a mess of else if and strcmp; here's a snippet of my parser, so you can see what I mean:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> first <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> <span style="color: #0000ff;">char</span><span style="color: #008000;">&#91;</span>256<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//Get first 4 characters</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span>line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">' '</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #FF0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">';'</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">'<span style="color: #000099; font-weight: bold;">\r</span>'</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    first<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #000040;">++</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//Get instruction</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  first<span style="color: #008000;">&#91;</span>j<span style="color: #000040;">++</span><span style="color: #008000;">&#93;</span><span style="color: #000080;">=</span><span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000; font-style: italic;">/*Flow*/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;jmp&quot;</span>, first<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>jumps<span style="color: #008000;">&#40;</span>line, second, j, result, table, size<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">dword</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">return</span> result<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">byte</span><span style="color: #008000;">&#91;</span>3<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #208080;">0x20</span><span style="color: #008080;">;</span><span style="color: #666666;">//Set the highest byte</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;jz&quot;</span>, first<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>jumps<span style="color: #008000;">&#40;</span>line, second, j, result, table, size<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">dword</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">return</span> result<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">byte</span><span style="color: #008000;">&#91;</span>3<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #208080;">0x24</span><span style="color: #008080;">;</span><span style="color: #666666;">//Set the highest byte</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;jg&quot;</span>, first<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//etc</span></div></li></ol></pre></div></div><br />
This honestly <span style="font-style: italic;">was</span> killing me!<br />
The reason for this issue, is because a string (whether it's the std string, or a char*) is pretty much an array of characters, and you can't treat an array as one value.<br />
<br />
My ultimate solution, was to hash the string, throw the solution keys into an enumeration, and run a switch() on the key -- it greatly improved the efficiency, and the num helped make things more sensible.<br />
<br />
There are other solutions though; one, is to use nested switch() statements -- they have been used professionally before, but at the cost of making your wonderful code look horrible, also, the efficiency drops the more nested switches you use; here's an example that does something for the following strings: "jmp", "je", "cat"<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#91;</span>0<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'j'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#91;</span>1<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'m'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #666666;">//do stuff for jmp</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'e'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #666666;">//do stuff for je</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'c'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#91;</span>1<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'a'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #666666;">//do stuff for &quot;cat&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li></ol></pre></div></div><br />
<br />
The second, is to use the STL Container classes, and use the strings as the key, and just have the entries point to functions like in a hash table.<br />
<br />
Other than that, I can't really think of any other ways of doing this.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Inline vs Non-Inline</span></span><br />
Just a quickie on here.<br />
If you call a certain function many times (esepcially a small function, such as void "addXY(int&amp; x, int&amp; y, int&amp; z) {z = x+y;}", you may want to consider making it inline.<br />
Use inline sparingly though, because it doesn't always result in faster code, and usually results in <span style="font-style: italic;">longer</span> code<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Preprocessors</span></span><br />
Another controversy is whether to use #define (and macros) or use typedef (or functions).<br />
Since the preprocessors are made during compile-time rather than run-time, they will be faster, but I personally use typedef over #define due to the fact I feel it's safer to work to work with type-safe objects then constants (you can fund much discussion on this subject).<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Compiler Flags</span></span><br />
For those using GCC, there are afew flags you should be aware of when compiling your code.<br />
First, the -O (not -o) flag, you can choose the level of compiler-size optimization for your code:<br />
-O0<br />
This option turns all optimizations off.<br />
-O1<br />
This option will try to reduce the code's size and efficiency while trying not to slow down the compiling process.<br />
-O2<br />
Level two optimization will enable as just about all the compiler optimizations that shouldn't hurt your program.  This one may show down the actual time it will take to compile, but it's worth it.<br />
I'd always recommend -O2<br />
-O3<br />
This turns all the optimizations on; there's a chance it will break your code though, I don't touch it.<br />
-mtune and -march<br />
mtune will tune your program to your CPU type, and march will generate assembly for your specific CPU (it will assume that mtune=march).<br />
If you don't mind your program only working on your computer, you can use:<br />
-march=native<br />
Which will detect your CPU type, and act accordingly.<br />
If you want your binary to execute on any machine (well, any x86), you can use -march=generic (or -mtune=generic); it will use all of those slow legacy instructions for the 8086 <img src="http://lastcode.net/images/smilies/CrystalXP/shocked.gif" style="vertical-align: middle;" border="0" alt="Surprised" title="Surprised" /><br />
You can see the rest of the -m optimizations here:<br />
<a href="http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html" target="_blank">http://gcc.gnu.org/onlinedocs/gcc/i386-a...tions.html</a><br />
<br />
<br />
<br />
Well, I hope this helped someone -- I enjoyed writing it atleat <img src="http://lastcode.net/images/smilies/CrystalXP/tongue.gif" style="vertical-align: middle;" border="0" alt="Tongue" title="Tongue" />]]></description>
			<content:encoded><![CDATA[Hi everyone.<br />
This is my very first real article on anything programming related, so bare with me.<br />
<br />
I'm not actually going to go too far into this, just going to bring up some small things that you can do to make your programs more efficient (sometimes slightly, other times greatly).<br />
<br />
Now, for those compiling with gcc, it's a pretty smart compiler, and it will most likely assume what you're trying to do, and correct it accordingly.  Though the same cannot be said about every compiler, or every version of every compiler; such as the while vs for (I'll get to that in a moment); I think microsoft and borland's compile it literally (optimization, aside).<br />
So it's better to be safe than sorry, especially if you don't know if your code will compiler on various platforms.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">while() vs for()</span></span><br />
<span style="font-style: italic;">NOTE:My compiler ended up auto-optimizing this, so I couldn't create some assembly code to match my argument (though you can google it up, and you'll find some code generated on other compilers which support this argument), but I can generate some assembly that would look similar, if you want</span>.<br />
<br />
There can be abit of controversy when it comes to for vs while for an infinite loop.<br />
In a literal compilation, while() and for() will not do the same thing.<br />
Consider the following two:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>while(1)<br />
&nbsp;&nbsp;std::cout&lt;&lt;"oh noes!"&lt;&lt;std::endl;<br />
for(;;)<br />
&nbsp;&nbsp;std::cout&lt;&lt;"oh noes!"&lt;&lt;std::endl;</code></div></div>
What the program may compile to in the first example (via pseudo-assembly) is:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">label<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Check <span style="color: #0000ff;">if</span> <span style="color: #FF0000;">'1'</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">print <span style="color: #FF0000;">&quot;oh noes!&quot;</span> endline</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">jump to <span style="color: #FF0000;">'label'</span></div></li></ol></pre></div></div><br />
Here's the second code:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000080;">&lt;</span>empty statement <span style="color: #000040;">--</span> <span style="color: #0000ff;">do</span> nothing<span style="color: #000080;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">label<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000080;">&lt;</span>empty statement <span style="color: #000040;">--</span> <span style="color: #0000ff;">do</span> nothing<span style="color: #000080;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">print <span style="color: #FF0000;">&quot;oh noes!&quot;</span> endline</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #000080;">&lt;</span>empty statement <span style="color: #000040;">--</span> <span style="color: #0000ff;">do</span> nothing<span style="color: #000080;">&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">jump to <span style="color: #FF0000;">'label'</span></div></li></ol></pre></div></div><br />
Where you see "&lt;empty statement -- do nothing&gt;", that's actually where the two semi-colons for the for loop are.<br />
So in short..<br />
A while() loop, since it's conditional, will validate to make sure that the condition '1' is true, if so, it will continue the loop, whereas a for() statement would have no statement to condition, so it simply loops.<br />
One fun thing I like to do in my code, is this:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339900;">#define EVER ;;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>EVER<span style="color: #008000;">&#41;</span> <span style="color: #666666;">//muhaha!</span></div></li></ol></pre></div></div><br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Postfix vs Prefix operators</span></span><br />
One thing I see alot in code, is the use of 'var++' over '++var'.<br />
Protip: Unless you need the value of 'var' before incrementing it, use pre-incremental.<br />
You may think, "what harm can ++i do?".  Honestly, not that much, if it's just an integer.<br />
See, when you use ++i, it increments i, and returns it's value.  When you're using i++, it stores the value of i, increments it, and returns it's old value.<br />
In assembly, this is just switching of three commands, but what about with objects?<br />
A great example I found <a href="http://www.codeguru.com/forum/showthread.php?t=231052" target="_blank">here</a>, is the following:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">class</span> MyClass</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">public</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    MyClass<span style="color: #000040;">&amp;</span> operator<span style="color: #000040;">++</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>    <span style="color: #666666;">//Prefix increment operator  (++x)</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #666666;">//Perform increment operation</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">return</span> <span style="color: #000040;">*</span><span style="color: #0000dd;">this</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    MyClass  operator<span style="color: #000040;">++</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #008000;">&#41;</span> <span style="color: #666666;">//Postfix increment operator (x++)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        MyClass temp <span style="color: #000080;">=</span> <span style="color: #000040;">*</span><span style="color: #0000dd;">this</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #666666;">//Perform increment operation</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #0000ff;">return</span> temp<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span></div></li></ol></pre></div></div><br />
As you see, a new object is initialized, holding the old object, and returns that object.<br />
This means that you're taking a performance shot to the stack every time you use postfix.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Dynamic allocation vs static (for lack of a better term) allocation.</span></span><br />
First off, let me define dynamic and static:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//static:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  object obj<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  foo <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  obj.<span style="color: #007788;">setValue</span><span style="color: #008000;">&#40;</span>foo<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//dynamic:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  object <span style="color: #000040;">*</span>obj <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> object<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> <span style="color: #000040;">*</span>foo <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> <span style="color: #0000ff;">int</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #000040;">*</span>foo <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  obj<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>setValue<span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span>foo<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000dd;">delete</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000dd;">delete</span> obj<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #666666;">//Please excuse my dereferencing if it's wrong.</span></div></li></ol></pre></div></div><br />
Now, the primary difference between the dynamic and static, is that when you dynamically allocate data, it is saved in the heap; whereas if you statically allocate it, it is saved on the stack.<br />
So for large objects, it's a good idea to dynamically allocate it, to preserve the stack.<br />
Another benefit of dynamically allocated objects, is that they don't have to follow the law of scope, and in a sense, they never go out of scope until they are manually deleted.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Two-Dimensional Array Access</span></span><br />
Access wouldn't be the word -- I should say traverse a two-dimensional array.<br />
But the question is, which is better to use?<br />
ary[x][y] or ary[y][x]?<br />
<br />
It may not seem like there's any difference, but one is actually much slower than the other.<br />
Here's an example of what the array foo[3][3] would look like in memory (don't question my epic pant skillz ;D):<br />
<img src="http://i49.tinypic.com/2qdslqv.png" border="0" alt="[Image: 2qdslqv.png]" /><br />
Putting more into perspective, consider the two:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>x<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> x<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>x<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>y<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> y<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>y<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    foo<span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>x<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> x<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>x<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span>y<span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> y<span style="color: #000080;">&lt;</span><span style="color: #0000dd;">3</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>y<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    foo<span style="color: #008000;">&#91;</span>y<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>x<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li></ol></pre></div></div><br />
Here is what the first five steps of the first for/for loop is doing in memory:<br />
(the red dot represents where in memory the program is pointing to, and the arrow represents where that pointer is pointing to).<br />
<img src="http://i46.tinypic.com/wt8zgo.png" border="0" alt="[Image: wt8zgo.png]" /><br />
As you can see, it's using the pointer foo[0] to reach each location of memory that is next to it.<br />
Next, we look at the second part:<br />
<img src="http://i46.tinypic.com/2ewpgkw.png" border="0" alt="[Image: 2ewpgkw.png]" /><br />
<br />
As you can see, the second way, the data pointer is throwing itself all over memory, instead of moving though it one block at a time.<br />
To prove it's length, here is a program I threw together (well, I modified it from the original C program my professor used last year) that creates an array that's 0xF00*0xF00 in size, and traverses it:<br />
<a href="http://pastebin.com/f45636265" target="_blank">http://pastebin.com/f45636265</a><br />
Here are the results for when I ran it:<br />
x-&gt;y: 0.0500<br />
y-&gt;x: 0.1000<br />
As expected, the latter was about half as slow.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">switch() vs else if</span></span><br />
I generated some assembly output for this one (I generated assembly output for the rest as well, but those aren't worth looking at).<br />
One thing I try to do, is use switch() as much as possible, as opposed to else if.<br />
Consider the following two programs:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> myVar <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span> 1<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">++</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span> 2<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  3<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">++</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  4<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">--</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  5<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  6<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x3</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  7<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  <span style="color: #000080;">&lt;</span>img src<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;http://lastcode.net/images/smilies/CrystalXP/glasses.gif&quot;</span> style<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;vertical-align: middle;&quot;</span> border<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;0&quot;</span> alt<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;Glasses&quot;</span> title<span style="color: #000080;">=</span><span style="color: #FF0000;">&quot;Glasses&quot;</span> <span style="color: #000040;">/</span><span style="color: #000080;">&gt;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  9<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x2a</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  10<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x801</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  11<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x6</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  12<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xfa</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  13<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x0354</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  14<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span>myVar<span style="color: #000040;">+</span><span style="color: #0000dd;">8</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>myVar <span style="color: #000080;">==</span>  15<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #0000dd;">415</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xF</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  foo <span style="color: #000080;">=</span> myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li></ol></pre></div></div><br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> myVar <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">int</span> foo<span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>myVar<span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 1<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #000040;">++</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">case</span> 2<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 3<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">++</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 4<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000040;">--</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 5<span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #000040;">--</span>myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 6<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x3</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 7<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 8<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xff</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 9<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x2a</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 10<span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x801</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 11<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x6</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 12<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0xfa</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 13<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #208080;">0x0354</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 14<span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span>myVar<span style="color: #000040;">+</span><span style="color: #0000dd;">8</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> 15<span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    myVar<span style="color: #000080;">=</span><span style="color: #0000dd;">415</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  foo <span style="color: #000080;">=</span> myVar<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li></ol></pre></div></div><br />
The brackets are left out, as it would make the else if too long.<br />
Now, when this is compiled, the first program would end up compiling into a mess of cmp and jmp commands, one-by-one, working its way down.<br />
If myVar happened to be 15, it would end up doing 15 conditionals.  The worst-case scenario here, would be that myVar isn't a number listed, and the result would be a test of every possible condition, until it reaches the else.<br />
<br />
As for the switch(), that actually manages to be pretty efficient (well... VERY efficient).<br />
This is because the second will compile into jump tables -- or hash maps.  This means that there is only <span style="font-style: italic;">one</span> test done, and it knows which to jump to.<br />
You can find the assembly output for the first program here: <a href="http://pastebin.com/f511c7140" target="_blank">http://pastebin.com/f511c7140</a> and the second here: <a href="http://pastebin.com/f654d9226" target="_blank">http://pastebin.com/f654d9226</a><br />
<br />
We now have a situation though.  And that's the question of "what should we do with strings?".<br />
I ran into this exact problem when I was writing my virtual machine, well, more specifically, my assembler.<br />
In my first version, I was using a mess of else if and strcmp; here's a snippet of my parser, so you can see what I mean:<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> first <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> <span style="color: #0000ff;">char</span><span style="color: #008000;">&#91;</span>256<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//Get first 4 characters</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span>line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">' '</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #FF0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">';'</span> <span style="color: #000040;">&amp;&amp;</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span><span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #FF0000;">'<span style="color: #000099; font-weight: bold;">\r</span>'</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    first<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> line<span style="color: #008000;">&#91;</span>j<span style="color: #000040;">++</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//Get instruction</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  first<span style="color: #008000;">&#91;</span>j<span style="color: #000040;">++</span><span style="color: #008000;">&#93;</span><span style="color: #000080;">=</span><span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff0000; font-style: italic;">/*Flow*/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;jmp&quot;</span>, first<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>jumps<span style="color: #008000;">&#40;</span>line, second, j, result, table, size<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">dword</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">return</span> result<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">byte</span><span style="color: #008000;">&#91;</span>3<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #208080;">0x20</span><span style="color: #008080;">;</span><span style="color: #666666;">//Set the highest byte</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;jz&quot;</span>, first<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span>jumps<span style="color: #008000;">&#40;</span>line, second, j, result, table, size<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">dword</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">return</span> result<span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      result.<span style="color: #007788;">byte</span><span style="color: #008000;">&#91;</span>3<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #208080;">0x24</span><span style="color: #008080;">;</span><span style="color: #666666;">//Set the highest byte</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">!</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">strcmp</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;jg&quot;</span>, first<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #666666;">//etc</span></div></li></ol></pre></div></div><br />
This honestly <span style="font-style: italic;">was</span> killing me!<br />
The reason for this issue, is because a string (whether it's the std string, or a char*) is pretty much an array of characters, and you can't treat an array as one value.<br />
<br />
My ultimate solution, was to hash the string, throw the solution keys into an enumeration, and run a switch() on the key -- it greatly improved the efficiency, and the num helped make things more sensible.<br />
<br />
There are other solutions though; one, is to use nested switch() statements -- they have been used professionally before, but at the cost of making your wonderful code look horrible, also, the efficiency drops the more nested switches you use; here's an example that does something for the following strings: "jmp", "je", "cat"<br />
<div class="codeblock"><div class="title"><span style="text-transform: uppercase;">cpp</span>&nbsp;Code:</div><div class="body"><pre class="cpp" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#91;</span>0<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'j'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#91;</span>1<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'m'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #666666;">//do stuff for jmp</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'e'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #666666;">//do stuff for je</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'c'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">switch</span><span style="color: #008000;">&#40;</span>str<span style="color: #008000;">&#91;</span>1<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">case</span> <span style="color: #FF0000;">'a'</span><span style="color: #008080;">:</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #666666;">//do stuff for &quot;cat&quot;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #008000;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #008000;">&#125;</span></div></li></ol></pre></div></div><br />
<br />
The second, is to use the STL Container classes, and use the strings as the key, and just have the entries point to functions like in a hash table.<br />
<br />
Other than that, I can't really think of any other ways of doing this.<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Inline vs Non-Inline</span></span><br />
Just a quickie on here.<br />
If you call a certain function many times (esepcially a small function, such as void "addXY(int&amp; x, int&amp; y, int&amp; z) {z = x+y;}", you may want to consider making it inline.<br />
Use inline sparingly though, because it doesn't always result in faster code, and usually results in <span style="font-style: italic;">longer</span> code<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Preprocessors</span></span><br />
Another controversy is whether to use #define (and macros) or use typedef (or functions).<br />
Since the preprocessors are made during compile-time rather than run-time, they will be faster, but I personally use typedef over #define due to the fact I feel it's safer to work to work with type-safe objects then constants (you can fund much discussion on this subject).<br />
<br />
<span style="font-size: x-large;"><span style="font-weight: bold;">Compiler Flags</span></span><br />
For those using GCC, there are afew flags you should be aware of when compiling your code.<br />
First, the -O (not -o) flag, you can choose the level of compiler-size optimization for your code:<br />
-O0<br />
This option turns all optimizations off.<br />
-O1<br />
This option will try to reduce the code's size and efficiency while trying not to slow down the compiling process.<br />
-O2<br />
Level two optimization will enable as just about all the compiler optimizations that shouldn't hurt your program.  This one may show down the actual time it will take to compile, but it's worth it.<br />
I'd always recommend -O2<br />
-O3<br />
This turns all the optimizations on; there's a chance it will break your code though, I don't touch it.<br />
-mtune and -march<br />
mtune will tune your program to your CPU type, and march will generate assembly for your specific CPU (it will assume that mtune=march).<br />
If you don't mind your program only working on your computer, you can use:<br />
-march=native<br />
Which will detect your CPU type, and act accordingly.<br />
If you want your binary to execute on any machine (well, any x86), you can use -march=generic (or -mtune=generic); it will use all of those slow legacy instructions for the 8086 <img src="http://lastcode.net/images/smilies/CrystalXP/shocked.gif" style="vertical-align: middle;" border="0" alt="Surprised" title="Surprised" /><br />
You can see the rest of the -m optimizations here:<br />
<a href="http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html" target="_blank">http://gcc.gnu.org/onlinedocs/gcc/i386-a...tions.html</a><br />
<br />
<br />
<br />
Well, I hope this helped someone -- I enjoyed writing it atleat <img src="http://lastcode.net/images/smilies/CrystalXP/tongue.gif" style="vertical-align: middle;" border="0" alt="Tongue" title="Tongue" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[QT&#93;I would like some help with cross compiling]]></title>
			<link>http://lastcode.net/showthread.php?tid=108</link>
			<pubDate>Sat, 20 Feb 2010 19:42:12 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=108</guid>
			<description><![CDATA[I am using Ubuntu&gt;Debian&gt;Linux&gt;Unix&gt;Linus Torvalds? <img src="http://lastcode.net/images/smilies/CrystalXP/biggrin.gif" style="vertical-align: middle;" border="0" alt="Biggrin" title="Biggrin" /><br />
And am wondering if I can compile with my linux system for win32?<br />
and if so how?<br />
sorry if the question is trivial I am very new to using QT and any programming language that requires it to be compiled.]]></description>
			<content:encoded><![CDATA[I am using Ubuntu&gt;Debian&gt;Linux&gt;Unix&gt;Linus Torvalds? <img src="http://lastcode.net/images/smilies/CrystalXP/biggrin.gif" style="vertical-align: middle;" border="0" alt="Biggrin" title="Biggrin" /><br />
And am wondering if I can compile with my linux system for win32?<br />
and if so how?<br />
sorry if the question is trivial I am very new to using QT and any programming language that requires it to be compiled.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Hello Everyone]]></title>
			<link>http://lastcode.net/showthread.php?tid=107</link>
			<pubDate>Sat, 20 Feb 2010 15:48:11 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=107</guid>
			<description><![CDATA[Hi,<br />
I'm Admiral Refuge.<br />
<br />
Mickcy sent me a link here abit ago, so I figured I'd join.<br />
<br />
I know abit about C/C++ (and afew others), so I suppose a programming forum will be nice.]]></description>
			<content:encoded><![CDATA[Hi,<br />
I'm Admiral Refuge.<br />
<br />
Mickcy sent me a link here abit ago, so I figured I'd join.<br />
<br />
I know abit about C/C++ (and afew others), so I suppose a programming forum will be nice.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[WEB HOSTS]]></title>
			<link>http://lastcode.net/showthread.php?tid=105</link>
			<pubDate>Fri, 19 Feb 2010 15:16:53 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=105</guid>
			<description><![CDATA[Here's a list of several web hosts sorted into convenient categories.<br />
<br />
<span style="font-weight: bold;">FREE SHARED</span><ul>
<li><a href="http://www.freehostia.com/" target="_blank">Freehostia</a></li>
<li><a href="http://www.000webhost.com/" target="_blank">000webhost</a></li>
<li><a href="http://byethost.com/" target="_blank">ByetHost</a></li>
<li><a href="http://xtreemhost.com/" target="_blank">XtreemHost</a></li>
<li><a href="http://www.mochahost.com/" target="_blank">MocaHost</a><br />
</li></ul>
<span style="font-weight: bold;">SHARED</span><ul>
<li><a href="http://secure.theforumforge.com/aff.php?aff=001" target="_blank">The Forum Forge</a></li>
<li><a href="http://www.freehostia.com/" target="_blank">Freehostia</a></li>
<li><a href="http://xtreemhost.com/" target="_blank">XtreemHost</a><br />
</li></ul>
<span style="font-weight: bold;">VPS</span><ul>
<li><a href="http://slicehost.com" target="_blank">Slicehost</a></li>
<li><a href="http://linode.com" target="_blank">Linode</a></li>
<li><a href="http://photonvps.com" target="_blank">PhotonVPS</a></li>
<li><a href="http://www.vps.net/" target="_blank">VPS.NET</a></li>
<li><a href="http://softlayer.com/" target="_blank">SoftLayer</a><br />
</li></ul>
<span style="font-weight: bold;">DEDICATED</span><ul>
<li><a href="http://steadfast.net/" target="_blank">Steadfast</a></li>
<li><a href="http://softlayer.com/" target="_blank">SoftLayer</a></li>
<li><a href="http://theplanet.com/" target="_blank">ThePlanet</a><br />
</li></ul>
<span style="font-weight: bold;">ALL OF ABOVE (except free)</span><ul>
<li><a href="http://byethost.com/" target="_blank">ByetHost</a></li>
<li><a href="http://hostgator.com/" target="_blank">HostGator</a></li>
<li><a href="http://www.mochahost.com/" target="_blank">MocaHost</a><br />
</li></ul>
<br />
If you'd like me to add another host please post a link in this thread.]]></description>
			<content:encoded><![CDATA[Here's a list of several web hosts sorted into convenient categories.<br />
<br />
<span style="font-weight: bold;">FREE SHARED</span><ul>
<li><a href="http://www.freehostia.com/" target="_blank">Freehostia</a></li>
<li><a href="http://www.000webhost.com/" target="_blank">000webhost</a></li>
<li><a href="http://byethost.com/" target="_blank">ByetHost</a></li>
<li><a href="http://xtreemhost.com/" target="_blank">XtreemHost</a></li>
<li><a href="http://www.mochahost.com/" target="_blank">MocaHost</a><br />
</li></ul>
<span style="font-weight: bold;">SHARED</span><ul>
<li><a href="http://secure.theforumforge.com/aff.php?aff=001" target="_blank">The Forum Forge</a></li>
<li><a href="http://www.freehostia.com/" target="_blank">Freehostia</a></li>
<li><a href="http://xtreemhost.com/" target="_blank">XtreemHost</a><br />
</li></ul>
<span style="font-weight: bold;">VPS</span><ul>
<li><a href="http://slicehost.com" target="_blank">Slicehost</a></li>
<li><a href="http://linode.com" target="_blank">Linode</a></li>
<li><a href="http://photonvps.com" target="_blank">PhotonVPS</a></li>
<li><a href="http://www.vps.net/" target="_blank">VPS.NET</a></li>
<li><a href="http://softlayer.com/" target="_blank">SoftLayer</a><br />
</li></ul>
<span style="font-weight: bold;">DEDICATED</span><ul>
<li><a href="http://steadfast.net/" target="_blank">Steadfast</a></li>
<li><a href="http://softlayer.com/" target="_blank">SoftLayer</a></li>
<li><a href="http://theplanet.com/" target="_blank">ThePlanet</a><br />
</li></ul>
<span style="font-weight: bold;">ALL OF ABOVE (except free)</span><ul>
<li><a href="http://byethost.com/" target="_blank">ByetHost</a></li>
<li><a href="http://hostgator.com/" target="_blank">HostGator</a></li>
<li><a href="http://www.mochahost.com/" target="_blank">MocaHost</a><br />
</li></ul>
<br />
If you'd like me to add another host please post a link in this thread.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[STARCRAFT 2 BETA]]></title>
			<link>http://lastcode.net/showthread.php?tid=102</link>
			<pubDate>Wed, 17 Feb 2010 18:33:18 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=102</guid>
			<description><![CDATA[YES. IT IS OUT TODAY - AWESOME!<br />
<br />
TORRENTING NOW! FOR THE WIN! SORRY FOR SHO-<br />
<br />
Oh god rand out of breath. Sweet, going to see if I can play tonight.<br />
<br />
<a href="http://starcraft.incgamers.com/blog/comments/starcraft-2-beta-has-started1/" target="_blank">http://starcraft.incgamers.com/blog/comm...-started1/</a>]]></description>
			<content:encoded><![CDATA[YES. IT IS OUT TODAY - AWESOME!<br />
<br />
TORRENTING NOW! FOR THE WIN! SORRY FOR SHO-<br />
<br />
Oh god rand out of breath. Sweet, going to see if I can play tonight.<br />
<br />
<a href="http://starcraft.incgamers.com/blog/comments/starcraft-2-beta-has-started1/" target="_blank">http://starcraft.incgamers.com/blog/comm...-started1/</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Just some suggestions.]]></title>
			<link>http://lastcode.net/showthread.php?tid=101</link>
			<pubDate>Wed, 17 Feb 2010 00:02:50 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=101</guid>
			<description><![CDATA[I thought I'd throw some input out there.<br />
<br />
First off, let me start by posting things I like<br />
<ul>
<li>Well founded</li>
<li>Organized forum board</li>
<li>Clean forum and nice clean logo!<br />
</li></ul>
<br />
Now, I would like to throw some suggestions out there.<br />
<ul>
<li>Getting Started Guides(A basic introduction guide for each section)</li>
<li>An Off Topic Section to replace the current General Section, then you can make General Section for Introductions and general topics related to the site(while not necessarily code related, and let General Discussions raise post counts</li>
<li>Some kind of Thank You Button or Karma System.  That really helps on sites like this, it helps set an impression on the time of feedback a user is going to give.</li>
<li>A more thorough Announcment of what this site is about(just go ahead and put rules inside that thread) Also could explain user groups and list all the administrators/moderators.</li>
<li>A section dedicated to projects, that don't necessarily have to relate to one side of code.  Something like "I'm starting such and such project who wants to be invovled"<br />
</li></ul>
<br />
<br />
Thanks for the time.  <img src="http://lastcode.net/images/smilies/CrystalXP/^^.gif" style="vertical-align: middle;" border="0" alt="^^" title="^^" />]]></description>
			<content:encoded><![CDATA[I thought I'd throw some input out there.<br />
<br />
First off, let me start by posting things I like<br />
<ul>
<li>Well founded</li>
<li>Organized forum board</li>
<li>Clean forum and nice clean logo!<br />
</li></ul>
<br />
Now, I would like to throw some suggestions out there.<br />
<ul>
<li>Getting Started Guides(A basic introduction guide for each section)</li>
<li>An Off Topic Section to replace the current General Section, then you can make General Section for Introductions and general topics related to the site(while not necessarily code related, and let General Discussions raise post counts</li>
<li>Some kind of Thank You Button or Karma System.  That really helps on sites like this, it helps set an impression on the time of feedback a user is going to give.</li>
<li>A more thorough Announcment of what this site is about(just go ahead and put rules inside that thread) Also could explain user groups and list all the administrators/moderators.</li>
<li>A section dedicated to projects, that don't necessarily have to relate to one side of code.  Something like "I'm starting such and such project who wants to be invovled"<br />
</li></ul>
<br />
<br />
Thanks for the time.  <img src="http://lastcode.net/images/smilies/CrystalXP/^^.gif" style="vertical-align: middle;" border="0" alt="^^" title="^^" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[O, hai :3]]></title>
			<link>http://lastcode.net/showthread.php?tid=100</link>
			<pubDate>Tue, 16 Feb 2010 18:20:34 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=100</guid>
			<description><![CDATA[Hello, my name is Christian, I have been coding for about 3 years now (C, C++, PHP, some Python and learning Java atm), I'll be lurking arround seeking for help or trying to help others if posible.<br />
<br />
I'm from Colombia, South America (Thats why my english is sucky), I was refered by Anman on the Tremulous forums (My nick there is Snake),  I hope to enjoy and learn a lot on these forums.<br />
<br />
Thank you for reading and your attention.<br />
<br />
<br />
:3 &lt;3]]></description>
			<content:encoded><![CDATA[Hello, my name is Christian, I have been coding for about 3 years now (C, C++, PHP, some Python and learning Java atm), I'll be lurking arround seeking for help or trying to help others if posible.<br />
<br />
I'm from Colombia, South America (Thats why my english is sucky), I was refered by Anman on the Tremulous forums (My nick there is Snake),  I hope to enjoy and learn a lot on these forums.<br />
<br />
Thank you for reading and your attention.<br />
<br />
<br />
:3 &lt;3]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Questions on Parsing]]></title>
			<link>http://lastcode.net/showthread.php?tid=99</link>
			<pubDate>Thu, 11 Feb 2010 15:08:17 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=99</guid>
			<description><![CDATA[Does anyone have any useful information on parsing text, based on the contents of a .xml file? <img src="http://lastcode.net/images/smilies/CrystalXP/great.gif" style="vertical-align: middle;" border="0" alt="Thumbs up" title="Thumbs up" />]]></description>
			<content:encoded><![CDATA[Does anyone have any useful information on parsing text, based on the contents of a .xml file? <img src="http://lastcode.net/images/smilies/CrystalXP/great.gif" style="vertical-align: middle;" border="0" alt="Thumbs up" title="Thumbs up" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[My Website]]></title>
			<link>http://lastcode.net/showthread.php?tid=98</link>
			<pubDate>Sun, 07 Feb 2010 21:32:24 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=98</guid>
			<description><![CDATA[What do you think of it? <a href="http://marksiforum.com" target="_blank">http://marksiforum.com</a>]]></description>
			<content:encoded><![CDATA[What do you think of it? <a href="http://marksiforum.com" target="_blank">http://marksiforum.com</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[BCS - Bad Code Spotter]]></title>
			<link>http://lastcode.net/showthread.php?tid=97</link>
			<pubDate>Sat, 30 Jan 2010 20:33:09 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=97</guid>
			<description><![CDATA[Bad Code Spotter (BCS) is a lightweight utility written in CSS to spot deprecated tags and attributes in HTML 4.1.<br />
<br />
Using it is simple, download the BCS file at the bottom of this post. Then put it in the same directory as your HTML file. Link the HTML file to BCS by putting this into the &lt;head&gt; section of the HTML document:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>&lt;link rel="stylesheet" type="text/css" href="bcs-v1.0.css" /&gt;</code></div></div>
Save the HTML file and open it in Mozilla Firefox or Google Chrome.<br />
<br />
<span style="font-weight: bold;">Key</span><br />
Red Background + Solid Red Border = Bad inline element<br />
Solid Dashed Border = Bad block element<br />
Solid Orange Border = Bad attribute on an element<br />
<br />
After you fixed the problems don't forget to remove the code!<br />
<br />
Live Demo: <a href="http://lastcode.net/dev/bcs" target="_blank">http://lastcode.net/dev/bcs</a> (Credits to Mickcy for the terrible code)]]></description>
			<content:encoded><![CDATA[Bad Code Spotter (BCS) is a lightweight utility written in CSS to spot deprecated tags and attributes in HTML 4.1.<br />
<br />
Using it is simple, download the BCS file at the bottom of this post. Then put it in the same directory as your HTML file. Link the HTML file to BCS by putting this into the &lt;head&gt; section of the HTML document:<br />
<div class="codeblock">
<div class="title">Code:<br />
</div><div class="body" dir="ltr"><code>&lt;link rel="stylesheet" type="text/css" href="bcs-v1.0.css" /&gt;</code></div></div>
Save the HTML file and open it in Mozilla Firefox or Google Chrome.<br />
<br />
<span style="font-weight: bold;">Key</span><br />
Red Background + Solid Red Border = Bad inline element<br />
Solid Dashed Border = Bad block element<br />
Solid Orange Border = Bad attribute on an element<br />
<br />
After you fixed the problems don't forget to remove the code!<br />
<br />
Live Demo: <a href="http://lastcode.net/dev/bcs" target="_blank">http://lastcode.net/dev/bcs</a> (Credits to Mickcy for the terrible code)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Unknown Error]]></title>
			<link>http://lastcode.net/showthread.php?tid=96</link>
			<pubDate>Mon, 25 Jan 2010 16:02:05 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=96</guid>
			<description><![CDATA[My GeSHi script keeps throwing me a specific error now (I don't need help on making it now, just figuring out this damn error). <br />
<br />
The error: "The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression."<br />
<br />
The code:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:<br />
</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />&nbsp;&#36;language_data&nbsp;</span><span style="color: #007700">=&nbsp;array&nbsp;(<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'LANG_NAME'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'jass'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'COMMENT_SINGLE'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'//'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'COMMENT_MULTI'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">'/*'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'*/'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'CASE_KEYWORDS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">GESHI_CAPS_NO_CHANGE</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'QUOTEMARKS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">'"'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'"'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'ESCAPE_CHAR'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'&#092;&#092;'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'KEYWORDS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array&nbsp;(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'native'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'constant'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'exitwhen'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'takes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'returns'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'private'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'public'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'keyword'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'static'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'delegate'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'initializer'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'uses'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'needs'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'requires'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'defaults'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'interface'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endinterface'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'globals'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endglobals'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'function'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endfunction'</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'scope'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endscope'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'library'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'library_once'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endlibrary'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'struct'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endstruct'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'method'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'endmethod'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'loop'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endloop'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'if'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'then'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'else'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'elseif'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endif'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'operator'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'readonly'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'stub'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'module'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endmodule'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'implement'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'optional'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'true'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'false'</span><span style="color: #007700">,</span><span style="color: #DD0000">'null'</span><span style="color: #007700">,</span><span style="color: #DD0000">'super'</span><span style="color: #007700">,</span><span style="color: #DD0000">'this'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'STYLES'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'KEYWORDS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'color:&nbsp;#050505;'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div>
<br />
Does anyone see anything that could cause this error?]]></description>
			<content:encoded><![CDATA[My GeSHi script keeps throwing me a specific error now (I don't need help on making it now, just figuring out this damn error). <br />
<br />
The error: "The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression."<br />
<br />
The code:<br />
<br />
<div class="codeblock phpcodeblock"><div class="title">PHP Code:<br />
</div><div class="body"><div dir="ltr"><code><span style="color: #0000BB">&lt;?php<br />&nbsp;&#36;language_data&nbsp;</span><span style="color: #007700">=&nbsp;array&nbsp;(<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'LANG_NAME'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'jass'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'COMMENT_SINGLE'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'//'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'COMMENT_MULTI'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">'/*'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'*/'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'CASE_KEYWORDS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">GESHI_CAPS_NO_CHANGE</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'QUOTEMARKS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(</span><span style="color: #DD0000">'"'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'"'</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'ESCAPE_CHAR'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'&#092;&#092;'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'KEYWORDS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array&nbsp;(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'native'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'constant'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'exitwhen'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'takes'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'returns'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'private'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'public'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'keyword'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'static'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'delegate'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'initializer'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'uses'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'needs'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'requires'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'defaults'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'interface'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endinterface'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'globals'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endglobals'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'function'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endfunction'</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'scope'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endscope'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'library'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'library_once'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endlibrary'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'struct'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endstruct'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'method'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'endmethod'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'loop'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endloop'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'if'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'then'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'else'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'elseif'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endif'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'operator'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'readonly'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'stub'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'module'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'endmodule'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'implement'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'optional'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'true'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'false'</span><span style="color: #007700">,</span><span style="color: #DD0000">'null'</span><span style="color: #007700">,</span><span style="color: #DD0000">'super'</span><span style="color: #007700">,</span><span style="color: #DD0000">'this'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'STYLES'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'KEYWORDS'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">1&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'color:&nbsp;#050505;'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span></code></div></div></div>
<br />
Does anyone see anything that could cause this error?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[VB.net&#93; Dope Wars]]></title>
			<link>http://lastcode.net/showthread.php?tid=95</link>
			<pubDate>Thu, 21 Jan 2010 11:34:12 -0600</pubDate>
			<guid isPermaLink="false">http://lastcode.net/showthread.php?tid=95</guid>
			<description><![CDATA[The original text based game is back, and being ported to VB.net by me!<br />
<br />
Currently, the game has a database system of drugs &amp; locations that is easily modified via text files, as well as a fully managed loan system, safehouse storage, buying/selling of drugs and more!<br />
<br />
The source code (when the game is done) will be available to anyone out there who wants it, and is relatively small right now (1,263 lines when I last counted).<br />
<br />
The port is also a console application for simplicity (and not having to deal with a GUI), and there are very few graphics (if any are there, there's only ASCII...and very little).<br />
<br />
The source code will be posted later on when I get the game to a stable release.]]></description>
			<content:encoded><![CDATA[The original text based game is back, and being ported to VB.net by me!<br />
<br />
Currently, the game has a database system of drugs &amp; locations that is easily modified via text files, as well as a fully managed loan system, safehouse storage, buying/selling of drugs and more!<br />
<br />
The source code (when the game is done) will be available to anyone out there who wants it, and is relatively small right now (1,263 lines when I last counted).<br />
<br />
The port is also a console application for simplicity (and not having to deal with a GUI), and there are very few graphics (if any are there, there's only ASCII...and very little).<br />
<br />
The source code will be posted later on when I get the game to a stable release.]]></content:encoded>
		</item>
	</channel>
</rss>