<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Invalid lvalue...</title>
		<link>http://www.allegro.cc/forums/view/586684</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 27 Jul 2006 17:14:47 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m trying to get Allegro Sprite Editor to compile...using Allegro 4.2 (ASE is supposed to use 4.0.3).  I&#39;ve tried the pre-built executable but it disagrees with my 4.2 runtime.  Anyways, that leaves me to do some tweaking in the ASE source to get it working.  So far, so good, I&#39;ve sorted out several trivial problems (such as ASE defining its own load_font function, even though Allegro has one with the same name) but I&#39;m stuck on this error:</p><p>72: invalid lvalue in increment</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">unsigned</span> <span class="k1">char</span> <span class="k3">*</span>address<span class="k2">;</span>
<span class="k1">unsigned</span> <span class="k1">char</span> value<span class="k2">;</span>
</pre></div></div><p>
...<br />...<br /><span class="source-code"><span class="n">72</span><span class="k2">:</span> <span class="k3">*</span><span class="k2">(</span><span class="k2">(</span><span class="k2">(</span><span class="k1">unsigned</span> <span class="k1">short</span> <span class="k3">*</span><span class="k2">)</span>address<span class="k2">)</span><span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k3">=</span> value<span class="k2">;</span></span></p><p>Pointer arithmetic is one of my weak areas - any idea what&#39;s wrong with line 72?</p><p>Alternatively, can anyone supply me with a compilable allegro 4.2 version of ASE?  Or better still, a binary that works? <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jakerohs)</author>
		<pubDate>Wed, 26 Jul 2006 11:40:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>((unsigned short *)address)++       huh?</p><p>your ++&#39;ing an address ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Wed, 26 Jul 2006 14:15:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>And he is casting a u_char in a u_short before that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 26 Jul 2006 14:33:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Pointer arithmetic is one of my weak areas
</p></div></div><p>
Then you really shouldn&#39;t be creating suspect constructions like this. There&#39;s so many things wrong with this statement, it&#39;s hard to know where to start.</p><p>Why are you casting a char to a short?<br />Why are you then assigning that casted value to another char?<br />And why, oh why, do people think that terse C code produces terse object code/assembly? Obfuscating your code does not make it smaller or faster, it just makes it obfuscated.</p><p>You need to stop for a moment and figure out what it is that you&#39;re really trying to accomplish. You should probably separate the pointer arithmetic from the assignment as well, or you&#39;ll be kicking yourself when you come back later and try to figure out what that line of code actually does, since it&#39;s clear that you barely understand it now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (_Dante)</author>
		<pubDate>Wed, 26 Jul 2006 21:01:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can&#39;t do that in one statement, because you can&#39;t apply pointer arithmetic of one type of pointer to another type of pointer, no matter how much you cast it. Try this:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k3">*</span><span class="k2">(</span><span class="k2">(</span><span class="k1">unsigned</span> <span class="k1">short</span> <span class="k3">*</span><span class="k2">)</span>address<span class="k2">)</span> <span class="k3">=</span> value<span class="k2">;</span>
address <span class="k3">+</span><span class="k3">=</span> <span class="k1">sizeof</span><span class="k2">(</span><span class="k1">unsigned</span> <span class="k1">short</span><span class="k2">)</span><span class="k3">/</span><span class="k1">sizeof</span><span class="k2">(</span><span class="k1">unsigned</span> <span class="k1">char</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Steve++)</author>
		<pubDate>Thu, 27 Jul 2006 00:43:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Then you really shouldn&#39;t be creating suspect constructions like this. There&#39;s so many things wrong with this statement, it&#39;s hard to know where to start.
</p></div></div><p>That code is from ASE, he didn&#39;t write it... <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (FMC)</author>
		<pubDate>Thu, 27 Jul 2006 02:45:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
That code is from ASE, he didn&#39;t write it...
</p></div></div><p>
Yeah, my bad. I was kind of feeding into the two previous comments. Nonetheless, that line is a fabulous example of how not to write C code.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (_Dante)</author>
		<pubDate>Thu, 27 Jul 2006 06:25:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What is ASE <img src="http://www.allegro.cc/forums/smileys/huh.gif" alt="???" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spunit262)</author>
		<pubDate>Thu, 27 Jul 2006 08:58:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I agree, this is a prime example of how <i>not</i> to code. Nonetheless, this is in the ASE source code.  I have <b>no</b> idea how the author got this stuff to compile, but anyhoo...</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
What is ase?
</p></div></div><p>
Allegro Sprite Editor. I can&#39;t tell you any more about it since I haven&#39;t gotten it working yet.</p><p>It <i>looks</i> to me like the author is trying to move the pointer along 2 bytes (size of an unsigned short) instead of 1 byte (for a char).  On most platforms.<br />I&#39;ll try substituting Steve++&#39;s code and see how that goes.</p><p>Edit:  Steve&#39;s code compiles fine (as it should).  It just gets worse though - here&#39;s the next compilation error:</p><p><span class="source-code"><span class="k2">(</span><span class="k2">(</span><span class="k1">unsigned</span> <span class="k1">char</span> <span class="k3">*</span><span class="k2">)</span>data-&gt;address<span class="k2">)</span> <span class="k3">+</span><span class="k3">=</span> data-&gt;image-&gt;w <span class="k3">&lt;</span><span class="k3">&lt;</span> data-&gt;shift<span class="k2">;</span></span></p><p>Ewwwwww <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /> </p><p>Thanks for the help guys, but I give up.  Allegro Sprite Editor is obviously someone&#39;s cruel joke, and I&#39;ve fallen for it.  You may all laugh at me now. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (jakerohs)</author>
		<pubDate>Thu, 27 Jul 2006 09:43:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;ve tried the pre-built executable but it disagrees with my 4.2 runtime.
</p></div></div><p>
Then get yourself alleg40.dll.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Allegro Sprite Editor is obviously someone&#39;s cruel joke, and I&#39;ve fallen for it.
</p></div></div><p>Well, if it hasn&#39;t been updated since Allegro 4.0.3 stopped being the last stable version of Allegro, then it&#39;s also probably dead.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (miran)</author>
		<pubDate>Thu, 27 Jul 2006 10:15:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>jake, your avatar seems to be flipped.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Thu, 27 Jul 2006 17:14:47 +0000</pubDate>
	</item>
</rss>
