<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>create_bitmap()  problem.</title>
		<link>http://www.allegro.cc/forums/view/519665</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Tue, 23 Aug 2005 00:19:24 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>why should this crash allegro ?<br />it crashes on the   free(bitmap)  inside of destroy_bitmap()<br />it says &quot;Damage after normal block&quot;<br />which sounds like memory corruption.</p><p>and yes i know, im requesting 0,0 size bitmap.</p><p>WinXP, alg 4.1.20b4  MSVC7.1 (2003 .net)</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span> p <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span> <span class="n">0</span>, <span class="n">0</span> <span class="k2">)</span><span class="k2">;</span>
<span class="k1">if</span> <span class="k2">(</span> p <span class="k2">)</span>
  <a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span> p <span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Mon, 15 Aug 2005 22:19:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In graphics.c I found two lines of code:</p><div class="source-code snippet"><div class="inner"><pre>bitmap <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_551.html" target="_blank">malloc</a><span class="k2">(</span><span class="k1">sizeof</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k2">)</span> <span class="k3">+</span> <span class="k2">(</span><span class="k1">sizeof</span><span class="k2">(</span><span class="k1">char</span> <span class="k3">*</span><span class="k2">)</span> <span class="k3">*</span> height<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
bitmap-&gt;dat <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_551.html" target="_blank">malloc</a><span class="k2">(</span>width <span class="k3">*</span> height <span class="k3">*</span> BYTES_PER_PIXEL<span class="k2">(</span>color_depth<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>If you really don&#39;t allocate space for the -&gt;dat then first malloc doesn&#39;t even allocate space for the -&gt;dat pointer and effectively bitmap will only get sizeof(BITMAP) bytes of memory and not (sizeof(BITMAP)-sizeof(BITMAP-&gt;dat) as it should. For the last four bytes in BITMAP, no memory will get allocated and everything that is written there will probably overwrite something useful.</p><p>That means you can&#39;t use Allegro with zero-pixel bitmaps. You should be able to create bitmaps of height==1 and width==0</p><p>[edit]</p><p>Of cource I might be wrong, I just saw the functions code for the first time in my life.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Mon, 15 Aug 2005 22:27:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try to compile in debug mode.</p><p>I.e., there is this at the beginning of the function:
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/ASSERT" target="_blank"><span class="a">ASSERT</span></a><span class="k2">(</span>width <span class="k3">&gt;</span><span class="k3">=</span> <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/ASSERT" target="_blank"><span class="a">ASSERT</span></a><span class="k2">(</span>height <span class="k3">&gt;</span> <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

So when run, your program should exit and point you to the line in the source where the problem happened. Using ASSERT simply is the way Allegro currently uses for runtime errors (instead of making the function fail and set an error code or raise an exception or whatever).</p><p>In any case, a 0x0 bitmap is not allowed, which the documentation specifically states: <a href="http://alleg.sourceforge.net/onlinedocs/en/alleg009.html#create_bitmap">http://alleg.sourceforge.net/onlinedocs/en/alleg009.html#create_bitmap</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Mon, 15 Aug 2005 22:29:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>if you accidently make a 0x0 sized bitmap, and no bitmap is created, then shouldn&#39;t create_bitmap() return NULL.<br />else, you would be lead to beleive you have a bitmap that needs to<br />get  destroy_bitmap()  which current crashes.</p><p>is there any reason why a create_bitmap(0,0) should return a valid pointer?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 Aug 2005 00:22:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>to make it a bit faster?</p><p>I think there should be a way to create bitmaps of 0x0 sizem adding another check shouldn&#39;t be so slow that it is only done with debug versions.</p><p>allthough this would probably make all image-saving functions a bit more difficult because I&#39;m not sure if the formats even support 0x0 images. Also I think some other functions assume that bitmaps have some image-data with them(e.g 3d rasterizing perhaps)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Tue, 16 Aug 2005 00:28:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>what the hell are you even considering 0x0 bitmaps as worth creating ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 Aug 2005 00:29:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
what the hell are you even considering 0x0 bitmaps as worth creating ?
</p></div></div><p>Why the hell would anyone even try creating 0x0 bitmaps <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p>Now that I thought of it a bit more I came to conclusion that it would probably be a lot easier to add the check to user side code, not in allegro.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Tue, 16 Aug 2005 00:32:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>the point of libs is to do as much work for you as possible.<br />lib should do it.  there is no reason it shouldn&#39;t.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 Aug 2005 04:32:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>really, would adding <span class="source-code"> <span class="k1">if</span> <span class="k2">(</span><span class="k2">(</span>w<span class="k3">&lt;</span><span class="n">1</span><span class="k2">)</span> <span class="k3">|</span><span class="k3">|</span> <span class="k2">(</span>h<span class="k3">&lt;</span><span class="n">1</span><span class="k2">)</span><span class="k2">)</span><span class="k2">{</span><span class="k1">return</span><span class="k2">(</span>NULL<span class="k2">)</span><span class="k2">;</span><span class="k2">}</span></span> to the beginning of create_bitmap() slow it down that much?</p><p>(it seems that passing in a negative height could cause all sorts of problems!)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Tue, 16 Aug 2005 16:12:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think ASSERT&#39;ing both w and h would be enough. Creating a 0-sized bitmap is considered an error, AFAIK, and no sane person would do it. So, if it does happen, it would be a bug in the code, which instead of just simply returning NULL, an ASSERT in debug mode would catch more effectively.</p><p>However, I do think both width and height need to be 1 or greater. If the width is allowed to be 0, you&#39;ll still get a 0-sized bitmap and have the same problems.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Tue, 16 Aug 2005 16:29:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Why is there so much resistance to having a library function do some sanity checking, what is the point of a library ?</p><p>Why would anyone want to create a zero sized bitmap, can anyone give me an example ?</p><p>Until BOTH these questions get answered, the only conclusion i can come too is that some of you are resisting for the sake of it.</p><p>allegro is a library, its not an application, it needs to SERVE the applications/programmers needs, not the other way around.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 Aug 2005 18:13:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The lib will do the Sanity check. As pointed out above, they&#39;ll add an ASSERT. So, what&#39;s the problem?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Tue, 16 Aug 2005 18:18:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">A J said:</div><div class="quote"><p>
Why would anyone want to create a zero sized bitmap, can anyone give me an example ?
</p></div></div><p>You tell us. It was you who started this thread because you had a problem with that. I have never before heard anyone having the same problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Tue, 16 Aug 2005 18:22:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As also pointed out above, there already is an ASSERT.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 16 Aug 2005 18:50:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yes, but width should be asserted to be &gt; 0 as well <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Tue, 16 Aug 2005 19:34:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ah, yes, could change this. But a width of 0 at least won&#39;t crash of do anything unexpected, so that&#39;s why who added the ASSERT made them as they are.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 16 Aug 2005 19:46:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>the problem is, create_bitmap(0,0) returns a valid pointer, that when passed to destroy_bitmap() crashes.<br />if i have a valid pointer, why does destroy_bitmap() crash ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 Aug 2005 21:19:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Compile your program in debug mode. Do you still have the problem?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Tue, 16 Aug 2005 21:28:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What is ASSERT? I agree with AJ, if the library gives lets you create a bitmap, and returns a valid bitmap without errors, why should it crash on destruction?</p><p>But, maybe destroy_bitmap() (since that&#39;s where it crashes) should be fixed?  Since destroy_bitmap usually isn&#39;t called until shutdown, and you can always check bmp-&gt;w/bmp-&gt;h</p><p>I wonder, can you blit to/from the 0 sized bitmap?  putpixel?  If all of the graphics routines crash while using it, then create_bitmap() should return NULL, but if the only problem is destroy_bitmap, then that&#39;s where it should be fixed; regardless of why you&#39;d create one, if it lets you create something you should be able to destroy it!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Tue, 16 Aug 2005 22:00:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It doesn&#39;t return a valid bitmap. That&#39;s the reason for the crash.<br />create_bitmap() uses a contract. Validation of this contract takes place only if you compile against the debug version of allegro.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spellcaster)</author>
		<pubDate>Tue, 16 Aug 2005 22:05:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s part of my point.  If it can&#39;t create a valid bitmap it should return NULL, not allocate the wrong amount of memory and return an unusable pointer that can&#39;t be deallocated via destroy_bitmap.  Just b/c there s no apparant use doesn&#39;t mean there is absolutley no use.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Tue, 16 Aug 2005 22:12:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It doesn&#39;t return NULL in debug mode.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Tue, 16 Aug 2005 22:19:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>release build, this causes a crash.
</p><div class="source-code snippet"><div class="inner"><pre><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span> p <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span><span class="n">0</span>,<span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<span class="k1">if</span> <span class="k2">(</span> NULL <span class="k3">!</span><span class="k3">=</span> p <span class="k2">)</span>
  <a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span> p <span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

As we seem to be having some trouble communicating exactly why this is considered OK, can i get a simplified bullet point list of reasons why it is OK for a library to crash destroying objects it made?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Tue, 16 Aug 2005 22:58:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
As we seem to be having some trouble communicating exactly why this is considered OK, can i get a simplified bullet point list of reasons why it is OK for a library to crash destroying objects it made?
</p></div></div><p>
Because of the general rule that as Allegro is built with speed critical applications in mind, functions do not have to check every single possible error condition and are allowed to crash if you pass wildly unexpected parameters. For example, it is allowed to crash on the following:</p><p>persp_project(1, 1, 0, &amp;x, &amp;y);</p><p>From that point of view, the question is not &quot;why it is OK for a library to crash destroying objects it made?&quot; but &quot;why should Allegro consider (0, 0) passed to create_bitmap to be sufficiently extraordinary that it may not handle the possibility of error?&quot;</p><p>I guess the current dev answer is that this sort of thing is better checked by the user or that it will occur to so few people as to make it prima facie sufficiently extraordinary.</p><p>Personally, I agree that a check should be incorporated that requested dimensions are both larger than 0 as Allegro only purports to be able to handle images, not data structures representing &quot;no image&quot;.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Wed, 17 Aug 2005 00:22:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
As we seem to be having some trouble communicating exactly why this is considered OK, can i get a simplified bullet point list of reasons why it is OK for a library to crash destroying objects it made?
</p></div></div><p>
Read up on <a href="http://en.wikipedia.org/wiki/Design_by_contract">Design by Contract</a>. This is what Allegro implements. It&#39;s a perfectly valid and widely used methodology.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Bob)</author>
		<pubDate>Wed, 17 Aug 2005 00:29:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The docs never said not to pass 0,0 to create_bitmap, so your point is mutt.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spunit262)</author>
		<pubDate>Wed, 17 Aug 2005 01:26:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It is kindof a trade off... you can have the &quot;contractual agreements&quot; enforced all of the time, or only enforce them under development (to ensure proper execution).  For the most part, the latter is the method that makes the most sense, because errors like this shouldn&#39;t creep up in a release-mode project (thus, you should compile your program in debug mode until all assertions are met (pre and post conditions)), then you should be safe to compile in release mode.  Unless of course this is a very security critical application, than keeping the pre and post condition checking in release mode is prudent.  Since most games are performance critcal, not security critical, it makes sense that these conditions are only checked during development, not continuously during runtime.</p><p>At least that is how I learned it in College CNS classes...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Carrus85)</author>
		<pubDate>Wed, 17 Aug 2005 01:27:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The docs never said not to pass 0,0 to create_bitmap, so your point is mutt.
</p></div></div><p>
They also don&#39;t say not to pass a casted BITMAP pointer to play_sample. So the docs not saying something is not enough to say that &quot;your point is mutt&quot;. At least is isn&#39;t based on my guess at what you mean by that, i.e. that mutt means void.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Wed, 17 Aug 2005 01:34:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
For speed critical functions (say the getpixel, putpixel type ones) then I agree that the checking may be a concern. But I don&#39;t know of any programmer who would do a create and destroy_bitmap call in a inner loop. Just the malloc alone must take much more time than the double check on the width and height.</p><p>For that reason, I would add the checks.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 17 Aug 2005 01:35:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
They also don&#39;t say not to pass a casted BITMAP pointer to play_sample. So the docs not saying something is not enough to say that &quot;your point is mutt&quot;. At least is isn&#39;t based on my guess at what you mean by that, i.e. that mutt means void.
</p></div></div><p> No one with a brain would do that, but there are zero size arrays so who&#39;s to say you can&#39;t make a zero size bitmap.<br />please use your brain before making counter arguments.&lt;/annoyed&gt;
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spunit262)</author>
		<pubDate>Wed, 17 Aug 2005 01:40:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
The docs never said not to pass 0,0 to create_bitmap, so your point is mutt.
</p></div></div><p>You are reading the wrong documantation <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>As was <a href="http://www.allegro.cc/forums/view_thread.php?_id=519670#target">reported earlier</a>, <a href="http://www.allegro.cc/go/http://alleg.sourceforge.net/onlinedocs/en/alleg009.html#create_bitmap">docs</a> do say that 0x0 bitmap is not allowed:<br /><i>The minimum height of the BITMAP must be 1 and width can&#39;t be negative.</i> </p><p>That means height must be 1, 2, 3, ..., a_big_number and width must be in 0, 1, 2, ..., a_big_number.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Wed, 17 Aug 2005 01:40:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
No one with a brain would do that, but there are zero size arrays so who&#39;s to say you can&#39;t make a zero size bitmap.<br />please use your brain before making counter arguments.
</p></div></div><p>
I&#39;ll use my brain when you start saying what you mean. Your sentence was &quot;The docs never said not to pass 0,0 to create_bitmap, so your point is mutt.&quot; which implies to me merely that points are &#39;mutt&#39; if they rely on people assuming things that aren&#39;t in the docs. I suggest you try a sentence such as &quot;This isn&#39;t obviously going to cause a problem and the docs never said not to pass 0,0 to create_bitmap, so your point is void.&quot; should you ever want to make the same point again.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Wed, 17 Aug 2005 01:51:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
which implies to me merely that points are &#39;mutt&#39;
</p></div></div><p>
I think he meant <a href="http://www.dict.org/bin/Dict?Form=Dict2&amp;Database=*&amp;Query=moot">&#39;moot&#39;</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Bob)</author>
		<pubDate>Wed, 17 Aug 2005 02:01:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s to long a stentes for me. I like to be short and to the point, witch sometime makes me sound rude. Ok. If your going to be overly picky end it with &lt;/jk&gt;, or some thing like that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (spunit262)</author>
		<pubDate>Wed, 17 Aug 2005 02:02:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>In the past, passing a NULL pointer to a %s argument in a printf call would crash the application. Nowadays I think it prints <i>(null)</i> instead. I would think processor speed is so good that using some checks inside the functions are not a big performance hit. However, programmers become lazy and stop checking because it is the library task.</p><p>At work we had this heated argument. In one side, everytime a friend got a NULL parameter which was not logically allowed, he would throw an error that would end crashing the application. In the other side, friends prefer handling the NULL pointer, in example, returning the function immediately, and dismissing the call. And the discussion was basically, the clients get pissed off because we make the application crash in order to get a full home made trackback and spot which check failed (isolating the problem and fixing in either the code or the client database), but if we didn&#39;t, we never learn the client&#39;s database had this problem which was carried over during months until it became so critical the database would take several weeks of intense working just to fix it.</p><p>Since Allegro is an amateur-for-amateur game programming, I believe checks are good. Allegro is usually the first or second game library a programmer would try, and it should be as newbie friendly as possible. If that includes checking for invalid parameters, so be it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Wed, 17 Aug 2005 02:12:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Couldn&#39;t you pass an error message to an internal string, set a flag, return without crashing and then in a seperate thread check for an error in the background and print out the full error details?</p><p>Or call a function pointer (if not NULL) from within each function if an error occured and passing it the error text. That would let people use custom error reporting functions..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 17 Aug 2005 02:17:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Maybe in debug mode. But most will just want the application to finish with the error message, just as most people want the default X behaviour is to close the window, as much asking if you really want to.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Wed, 17 Aug 2005 02:23:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
In the past, passing a NULL pointer to a %s argument in a printf call would crash the application. Nowadays I think it prints (null) instead.
</p></div></div><p>
I think it depends on the optimization settings and the compiler. I rememberfor one game I was making, DJGPP would print &quot;(null)&quot;, but under Linux, with a newer GCC, it would crash.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Wed, 17 Aug 2005 02:30:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think he meant &#39;moot&#39;
</p></div></div><p>
In which case I had entirely the wrong idea about what he was saying and all misunderstandings are entirely my fault. Apologies all round! Obviously there is a gulf of difference between a void point (one which is clearly invalid) and a moot one (one which is sufficiently borderline to be arguable either way).
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Since Allegro is an amateur-for-amateur game programming, I believe checks are good. Allegro is usually the first or second game library a programmer would try, and it should be as newbie friendly as possible. If that includes checking for invalid parameters, so be it.
</p></div></div><p>
I agree with this, especially since there can&#39;t be a reasonable developer on the planet trying to get decent performance out of any loop which involves a malloc?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Wed, 17 Aug 2005 03:32:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>given create_bitmap() is not speed critical, is there any harm in adding the check.<br />i also like the point ReyBrujo made, that its often a noobs 1st choice of game lib, so lets make it as helpful as possible.</p><p>can we set a errno number for this condition, so the user after receiving a NULL ptr can check it to find out why.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Wed, 17 Aug 2005 03:43:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
given create_bitmap() is not speed critical, is there any harm in adding the check
</p></div></div><p>
Personally, I wouldn&#39;t mind a check for both to be &gt; 0, but I really would like those assert&#39;s to remain. So, like:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">// ASSERT in debug, so a debugger will catch the problem</span>
<a href="http://www.allegro.cc/manual/ASSERT" target="_blank"><span class="a">ASSERT</span></a><span class="k2">(</span>w <span class="k3">&gt;</span> <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/ASSERT" target="_blank"><span class="a">ASSERT</span></a><span class="k2">(</span>h <span class="k3">&gt;</span> <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>

<span class="c">// Otherwise, make sure we'll be allocating something</span>
<span class="k1">if</span><span class="k2">(</span>w <span class="k3">&lt;</span> <span class="n">1</span> <span class="k3">|</span><span class="k3">|</span> h <span class="k3">&lt;</span> <span class="n">1</span><span class="k2">)</span>
    <span class="k1">return</span> NULL<span class="k2">;</span>
...
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Wed, 17 Aug 2005 03:51:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just a quick round of answers before I roll into bed. These are my personal views after skimming through the thread with a throbbing headache and a sore throat so I apologise beforehand if I insult anyone.</p><p>The docs clearly say that you cannot create a 0x0 size bitmap. If you try to do so anyway, the consequences are for you. Perhaps it can be argued that destroy_bitmap() should not crash or create_bitmap() should return NULL instead, but since the user code is in error in this case I personally don&#39;t think this is proper behavior for the library. Changing this in the way suggested will make code run normally (without errors) in release mode and it will cause a crash in debug mode. This is not acceptable.</p><p>Allegro&#39;s policy is to do pedantic sanity checks only in debug mode and at least for 4.2, this is not going to change. How failures and problems should be dealt with after 4.2 is a different discussion.</p><p>No, passing NULL to a %s format specifier in printf() is <i>not</i> ok. If the result is the insertion of the string (null) this is non-standard behavior (granted, it&#39;s non-standard behavior used by many compilers, but it&#39;s still non-standard). We&#39;ve had a few patches to Allegro that solved crashes because the library assumed it did.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Wed, 17 Aug 2005 04:41:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Perhaps it can be argued that destroy_bitmap() should not crash or create_bitmap() should return NULL instead, but since the user code is in error in this case I personally don&#39;t think this is proper behavior for the library.
</p></div></div><p>
I&#39;m not totally sure if returning an invalid bitmap should be allowed either, though. IMO, it should either return a bitmap with a NULL dat field, or a NULL struct. Neither should cause problems when passing the result to destroy_bitmap, so this would always work:<br /><span class="source-code"><a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span>w, h<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Wed, 17 Aug 2005 05:02:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
will make code run normally (without errors) in release mode and it will cause a crash in debug mode. This is not acceptable.
</p></div></div><p>

kittycats suggestion, of leaving the asserts in but including the check after the asserts, would allow debug &amp; release modes to act consistantly, whilst offering warnings to users in debug mode via the asserts.</p><p>Should all non-speed critical functions check input parameters for sanity ?</p><p>[edit]<br />create_bitmap() docs say:<br />&quot;Return value: Returns a pointer to the created bitmap, or NULL if the bitmap could not be created.&quot;</p><p>to me the &quot;or&quot; word implies the 1st half of the sentence is the opposite to the end, the end being NULL if not created, therefore the start of the sentence says non-NULL if created.  So if a bitmap is created successfully (non-NULL ptr), then it should be able to feed that ptr to destroy_bitmap() without a hard crash.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Wed, 17 Aug 2005 16:20:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>you all should know what you code.</p><p>create_bitmap crash if size is 0x0 ? so don&#39;t use a 0x0 size.</p><p>it is evil to think that library develloper must have a thought to everything.</p><p>error checking is also the job of the user of the lib.</p><p>Excuse me, but if you&#39;re too dumb to not do yourself some check, you &#39;ll loose a lot of time on non-initialised pointer &amp; else when debugging.</p><p>Aren&#39;t you checking , when doing A=1/B , if B isn&#39;t zero ? i hope you do.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 17 Aug 2005 16:32:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>BTW
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Changing this in the way suggested will make code run normally (without errors) in release mode and it will cause a crash in debug mode. This is not acceptable.
</p></div></div><p>
Returning a NULL bitmap is considered an error (it&#39;s not wanted behavior).. means something went wrong and the bitmap couldn&#39;t be made. I can&#39;t think of a situation where a returned NULL bitmap doesn&#39;t indicate a problem. However, by returning NULL in release, it allows the program to handle it more gracefully, while in debug mode the ASSERT&#39;s would throw the problem to the debugger.</p><p>EDIT:
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
create_bitmap crash if size is 0x0 ? so don&#39;t use a 0x0 size.
</p></div></div><p>
create_bitmap doesn&#39;t crash. It crashes when you try to call destroy_bitmap on a 0-sized bitmap. And no one&#39;s saying 0x0 bitmaps should be allowed.. we&#39;re just determining what the best method of dealing with it would be (return an error with a NULL bitmap so the program can handle the problem, or let it create an invalid bitmap that <b>will</b> crash the program later).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
it is evil to think that library develloper must have a thought to everything.
</p></div></div><p>
Which is why we&#39;re bringing it up, since someone else found it. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
error checking is also the job of the user of the lib.
</p></div></div><p>
What should be checked by the user, and what should be checked by the lib? In non-speed-critical functions, such as this, it should be safe to assume the lib will make sure it won&#39;t cause a situation to allow <b>itself</b> to crash later.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Excuse me, but if you&#39;re too dumb to not do yourself some check, you &#39;ll loose a lot of time on non-initialised pointer &amp; else when debugging.
</p></div></div><p>
When your projects get larger and larger, it becomes increasingly harder to keep track of everything. Situations that couldn&#39;t happen before could happen now, but you wouldn&#39;t realize it until it&#39;s too late. For non-speed critical functions, it&#39;d be best to let the lib check and save on having all of its users program the exact same safety checks (or not, and risk questions of why the program crashes, and time wasting hunting uncaught problems).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Aren&#39;t you checking , when doing A=1/B , if B isn&#39;t zero ? i hope you do.
</p></div></div><p>
Not in situations where I can&#39;t conceive B being 0. And if it is, it&#39;ll crash, I&#39;ll debug, and catch the problem. Something like this would be easy since it crashes right where the problem is. But with a 0-sized bitmap, you may not get a crash until the program closes, even if the problem is when the program begins.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Wed, 17 Aug 2005 16:33:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I agree, we could change this for create_bitmap, especially since it would be consistent to load_bitmap to return NULL in case it fails.</p><p>But in general, what is a speed critical function?</p><p>If I do:
</p><div class="source-code snippet"><div class="inner"><pre>bmp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span>w, h<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/line" target="_blank"><span class="a">line</span></a><span class="k2">(</span>bmp, <span class="n">0</span>, <span class="n">0</span>, <span class="n">10</span>, <span class="n">10</span>, <span class="n">0</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

Then it will crash now in line 2. line certainly isn&#39;t a speed critical function (adding a check for NULL takes no time at all compared to all the checks it already has to do). So, this really opens a can of worms..</p><p>I&#39;d say, we should leave the ASSERTs in 4.2.0, they are a perfectly good way of error checking.</p><p>After 4.2.0, we could implement something like OpenGL, where every function returns an error code. Or maybe even better, provide a global error callback which is called for errors (in which you can e.g. raise an exception - or in C you could use longjmp to jump to a user exception handler).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 17 Aug 2005 17:17:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>it is speed critical if you do this:</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">while</span><span class="k2">(</span>do_draw<span class="k2">)</span><span class="k2">{</span>
<a href="http://www.allegro.cc/manual/line" target="_blank"><span class="a">line</span></a><span class="k2">(</span>...<span class="k2">)</span>
<span class="k2">}</span>
</pre></div></div><p>

an error check will slow the draw loop.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 17 Aug 2005 17:28:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not really, just because you use it in a loop doesn&#39;t make it speed critical, else create_bitmap would be as well:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">while</span><span class="k2">(</span>do_draw<span class="k2">)</span><span class="k2">{</span>
bmp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span>...<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/line" target="_blank"><span class="a">line</span></a><span class="k2">(</span>bmp, ...<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/blit" target="_blank"><span class="a">blit</span></a><span class="k2">(</span>..., bmp, ...<span class="k2">)</span><span class="k2">;</span>
<a href="http://www.allegro.cc/manual/destroy_bitmap" target="_blank"><span class="a">destroy_bitmap</span></a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 17 Aug 2005 17:33:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><i>create_bitmap</i> is so slow that adding a check there is depreciable.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Wed, 17 Aug 2005 17:39:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Elias: you&#39;re re-creating your bitmap each loop ?</p><p>Using line in a loop is , i think, normal.<br />Using create_bitmap inside a loop is, i think , EVIL (the way you post)</p><p>EDIT: i mean in a drawing loop
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 17 Aug 2005 17:41:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can do 2937779 create/destroy_bitmap pairs with a 1x1 bitmap in a second, and can do only 44555 lines from 0/0 to 1000/1000 in a second. So now, which one is speed critical? <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p>Of course, both times, the additional check would not change it noticeable at all I think.</p><p>So, just want to demonstrate that it&#39;s hard to decide what is speed critical. OpenGL has error checking for every single function, so we could have it too after 4.2.0. For 4.2.0, ASSERT is simply the way that was chosen for error handling, and since it works perfectly well, no need to change it.</p><p>[Edit:] Temporary bitmaps in the draw loop are needed for example if you want a stretch_trans_blit, or stretched_printf, or things like that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 17 Aug 2005 17:54:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>So the conclusion should be that assertions should never be disabled unless absolutely critical for speed.  Then create_bitmap(0,0) would always abort regardless of whether you use the release or debug version of Allegro.  Great!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Wed, 17 Aug 2005 17:57:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>:p
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Wed, 17 Aug 2005 18:02:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>[</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Temporary bitmaps in the draw loop are needed for example if you want a stretch_trans_blit, or stretched_printf, or things like that.
</p></div></div><p>
Temporary bitmaps aren&#39;t <b>necessary</b>, they&#39;re used there because it makes implementation easier and/or are the fastest method of doing what is required. It&#39;s a circular argument. If bitmap creation were substantially slower then (hopefully) it wouldn&#39;t be done in things like stretch_trans_blit and stretched_printf (really - &#39;stretched&#39;? Is someone actually on a mission to create the least orthogonal API?).</p><p>Besides which, anything that relies on malloc relies on OS services, so speed is highly dependent on OS. Perhaps this is (another) reason why us OS X&#39;ers see about 1/4 the frame rate of our PC cousins?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Wed, 17 Aug 2005 20:19:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I wasn&#39;t talking about Allegro functions there, it was just an example why you might need create_bitmap in a draw loop (to support my argument that this can&#39;t be a criterion what needs error checking and what not).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 17 Aug 2005 20:36:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>so are we in agreement create_bitmap() is not speed critical ?</p><p>asserts and a check is the best option ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Thu, 18 Aug 2005 00:59: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 wasn&#39;t talking about Allegro functions there, it was just an example why you might need create_bitmap in a draw loop (to support my argument that this can&#39;t be a criterion what needs error checking and what not).
</p></div></div><p>
You&#39;d only create the bitmap when you need to, and recycle it for later. In the loop, you&#39;d check that the bitmap exists, and that it&#39;s big enough. If not, you make a big enough bitmap, and leave it around for the next iteration. Yeah, this may cause the first iteration to lag, but it&#39;s a one-time deal.. the bitmap will stay around so you can use it as-is on subsequent run-throughs (no additional mallocs necessary). I actually did this when I was working with Allegro to do translucent (normal and additive) software polygons.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I can do 2937779 create/destroy_bitmap pairs with a 1x1 bitmap in a second, and can do only 44555 lines from 0/0 to 1000/1000 in a second. So now, which one is speed critical?
</p></div></div><p>
line is still speed critical, even if it ends up being slower. The idea is that you can use line multiple times in quick succession per frame render. The faster the better. Creating a bitmap, however, doesn&#39;t typcially get used outside of initialization (or in the manner I outlined above) where speed isn&#39;t as much of an issue.. that a few extra if checks aren&#39;t going to cause speed problems for a program.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Thu, 18 Aug 2005 01:13:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, I myself was wondering why you wouldn&#39;t just create a &quot;working&quot; bitmap outside of the loop, and just recycle it... (and destroy/create it again if the size changes for some reason). <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Carrus85)</author>
		<pubDate>Thu, 18 Aug 2005 01:15:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>While I think Elias&#39;s line argument is kind of bogus, I really don&#39;t think checking for NULL in drawing functions would lead to much of a slower program, in all of my draw loops, functions that take a bitmap as an argument or call create_bitmap etc I always check for null, not that I expect any of them to fail (except incase of a logic error, or file not found error) If I remove the checks my program speed difference is competley unnoticable, plus it&#39;s safer to leave them in.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
No one with a brain would do that, but there are zero size arrays so who&#39;s to say you can&#39;t make a zero size bitmap.<br />please use your brain before making counter arguments.&lt;/annoyed&gt;
</p></div></div><p> if a zero sized bitmap is allowed then it&#39;s destroyal should also be allowed.  And saying &quot;no one with a brain would do that&quot; is a completely worthless argument, that having been said, no one with a brain would have posted what you have! <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Changing this in the way suggested will make code run normally (without errors) in release mode and it will cause a crash in debug mode. This is not acceptable.
</p></div></div><p> No it wouldn&#39;t.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
so this would always work:<br />destroy_bitmap(create_bitmap(w, h));
</p></div></div><p>
not if create bitmap returns null -- or did I miss something? are null checks being added to everything?  Actually, adding a null check to destroy bitmap isn&#39;t a bad idea, I don&#39;t think I&#39;ve evern seen anyone sanley calling destroy_bitmap(bmp) without first checking if bmp is null, and if create_bitmap is not speed critical, why should destroy_bitmap be? it&#39;s usually only called when shutting down!</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Aren&#39;t you checking , when doing A=1/B , if B isn&#39;t zero ? i hope you do.
</p></div></div><p> I usually don&#39;t perform much division unless I&#39;m using doubles... (it&#39;s Ok to divide a double by 0, and actually useful.)</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
After 4.2.0, we could implement something like OpenGL, where every function returns an error code. Or maybe even better, provide a global error callback which is called for errors (in which you can e.g. raise an exception - or in C you could use longjmp to jump to a user exception handler).
</p></div></div><p> User-Defined error handlers would be SWEET!</p><p>As far as create bitmap goes, to me it makes more sense to let the lib do the checking because it&#39;s one if statement, and the create_bitmap could return faster in rare instances where it can pre-determine that it doesn&#39;t even have to call malloc.  If the user was required to do this, a code bloat could occur, it makes sense to put the check at the base-level so that there&#39;s absolutley no chance of it accidently not getting checked for.</p><p>Edit:
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Besides which, anything that relies on malloc relies on OS services, so speed is highly dependent on OS. Perhaps this is (another) reason why us OS X&#39;ers see about 1/4 the frame rate of our PC cousins?
</p></div></div><p>

If it is, it would be neat if allegro could allocate a chunk of memory at the beginning of the program and preformed it&#39;s own memory managment/allocation on that chunk to bypass the OS&#39;s speed issue...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Thu, 18 Aug 2005 07:29:09 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
not if create bitmap returns null -- or did I miss something?
</p></div></div><p>
AFAIK, destroy_bitmap does nothing with a NULL pointer. I simply returns. IMO, anything that create_* returns, destroy_* should accept without problems.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Thu, 18 Aug 2005 07:57:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
if a zero sized bitmap is allowed then it&#39;s destroyal should also be allowed.
</p></div></div><p>
Yes. Thing is, they&#39;re <i>not</i> allowed.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I don&#39;t think I&#39;ve evern seen anyone sanley calling destroy_bitmap(bmp) without first checking if bmp is null
</p></div></div><p>
In that case, you&#39;ve never seen my code. create/destroy behaves like alloc/free: it does nothing with a NULL pointer.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If the user was required to do this, a code bloat could occur, it makes sense to put the check at the base-level so that there&#39;s absolutley no chance of it accidently not getting checked for.
</p></div></div><p>
It is the user&#39;s responsibility to pass valid, sane, arguments to a function. The library should, in my opinion, do sanity checks in debug mode but not in release mode. Compare the speed difference between the library in debug mode and release mode. It could be minor on your machine and for your programme, but that doesn&#39;t mean it would be for everyone.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
IMO, anything that create_* returns, destroy_* should accept without problems.
</p></div></div><p>
Yes, no argument there.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 18 Aug 2005 13:44:06 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I really don&#39;t think checking for NULL in drawing functions would lead to much of a slower program
</p></div></div><p>
It shouldn&#39;t make much odds at all, it&#39;s presumably the difference between:</p><p>LD register, pointer value</p><p>And:</p><p>LD register, pointer value<br />BRA.Z .return_code</p><p>Especially with branch prediction very effectively preventing any sort of stall in close repeated calls it isn&#39;t much of a difference.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If it is, it would be neat if allegro could allocate a chunk of memory at the beginning of the program and preformed it&#39;s own memory managment/allocation on that chunk to bypass the OS&#39;s speed issue...
</p></div></div><p>
Firstly, it&#39;s wild speculation that this particular thing is a speed issue, I was just making the point that most of the time, the way things are implemented on Allegro is dictated by quick tests or by programmer intuition. Since a lot of the non-DOS/Windows versions seem to be very slow then this possibly needs addressing.</p><p>Secondly, Allegro is already a 90% bloat library for most people that being DOS-centric in design eats 100% CPU at runtime, can it really justify taking an unnecessarily gigantic chunk of memory as well?
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
It is the user&#39;s responsibility to pass valid, sane, arguments to a function. The library should, in my opinion, do sanity checks in debug mode but not in release mode.
</p></div></div><p>
Then you definitely want to look at functions such as get_camera_matrix. Expect the user to be able to pass orthogonal &#39;up&#39; and &#39;front&#39; vectors or keep things normalised at their end? Nah, lets just force two sqrts and a bunch of dot products on them.</p><p>EDIT: probably the smartest thing to do instead of a function by function disassembly is to work out all the <a href="http://en.wikipedia.org/wiki/Anti-pattern">anti-patterns</a> in Allegro? I&#39;m new to this, but I definitely spot abstraction inversion, accidental complexity, busy waiting, code momentum, continuous obsolescence, creeping featurism, procedural code and the aura of a stovepipe system.</p><p>But I assume 4.3 will be a clean sweep of much of this, or at least an API that allows a clean sweep?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Thu, 18 Aug 2005 16:32:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thomas can you give 1 example in allegro, of each of those anti-patterns you mentioned ?     or are you just a warm-body <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Thu, 18 Aug 2005 18:01:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Thomas can you give 1 example in allegro, of each of those anti-patterns you mentioned ? or are you just a warm-body
</p></div></div><p>
Can do! I&#39;d never actually heard of this stuff before, but discovered it yesterday while searching for the Gang of Four, a historical political grouping here in the UK. Turns out another Gang of Four wrote a book that expounds most of the terms on that page. Point is, I may well be misunderstanding or misapplying any quantity of the group. Anyway...</p><p><b>abstraction inversion</b><br />The bundles and sets of code most of us have self written and squirreled away for screen update, automatically switching between memory buffering, page flipping, etc. A potential argument is that this isn&#39;t abstraction inversion because the user is merely collecting together the hardware resources that Allegro abstracts, but when you look at the code for things like the OS X port you discover, for example, that Allegro doesn&#39;t tap into any hardware for page flipping but emulates it in software.</p><p><b>accidental complexity</b><br />Wikipedia quote: &quot;accidental complexity may be caused by misunderstanding of problems, ineffective planning...&quot;. I assert that Allegro has had what amounts to ineffective planning due to its &quot;good idea for DOS, now let&#39;s port it!&quot; approach. Complexity is introduced by the array of different video techniques, as described above, as well as the way that FONTs are not composed of normal bitmaps except in 16/24bit mode, the distinction between a VOICE and an AUDIOSTREAM, etc</p><p><b>busy waiting</b><br />Demonstrated by almost every Allegro application that attempts to be frame rate indepdendent.</p><p><b>code momentum</b><br />Created by things like rotate_stretch_pivot_bitmap as compared to the two other functions rotate_pivot_bitmap and stretch_bitmap. Which are all hypothetical because I don&#39;t have the Allegro manual to hand, but you get the point. Compare and contrast with OpenGL or DirectDraw, the former of which uses modal parameters and the latter uses, for the limited functions it has, states attached to objects.</p><p><b>continuous obsolescence</b><br />Industry trends have brought Windows to the forefront, the Mac back as a significant player for hobbyist developers and invented Linux as a useable gaming platform in the time since Allegro was first implemented. At the minute much more work seems to go into getting every piece of Allegro to work on every platform it is meant to support than in improving the API, etc. See the huge number of OS X problems being reported (admittedly mostly by me) - 8bit desktop mode not working, joystick input unreliable if you want to allow the user to redefine keys, etc</p><p><b>creeping featurism</b><br />Possibly the least controversial of my list. Allegro is historically very guilty of this, although it seems to have stopped lately. So I withdraw this one as a going concern and apologise for raising it.</p><p><b>procedural code</b><br />Which in this case means &quot;building indivisible, monolithic solutions to problems by not factoring out commonalities&quot; - see examples of &quot;code momentum&quot; above.</p><p><b>stovepipe system</b><br />Defined as &quot;a legacy system which cannot be upgraded or refactored and which must be built around until it can be replaced entirely&quot;. See the abandonment of Allegro 5.0 and instead the idea of building a new API over the existing one then gradually filtering out the old stuff.</p><p>Aside: it would be very interesting to make a virtual middle layer Allegro DLL that simply flagged which functions were used then passed calls on to the real DLL and then to run a whole bunch of Allegro programs through it and find out what proportion of the API is actually in common use. I may try that one day if I ever return to the Windows fold.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Thu, 18 Aug 2005 18:42:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This is somewhat sidetracking the original topic, and I don&#39;t think we need another discussion on what things need to be changed in Allegro. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /> We&#39;re aware of the problems, but we&#39;re only a few people working on this in our spare time. Beside which, 4.2 needs to be out of the way first.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Complexity is introduced by the array of different video techniques, as described above, as well as the way that FONTs are not composed of normal bitmaps except in 16/24bit mode
</p></div></div><p>
Actually, I 8 bit fonts are normal BITMAPs as well. Only monochrome fonts are different, which is not that surprising considering that Allegro doesn&#39;t support monochrome bitmaps.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
At the minute much more work seems to go into getting every piece of Allegro to work on every platform it is meant to support than in improving the API
</p></div></div><p>
As I&#39;m sure you&#39;re aware, that&#39;s because we want to get 4.2 out. API improvements are post 4.2</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
See the huge number of OS X problems being reported (admittedly mostly by me)
</p></div></div><p>
Yes, and do keep them coming! Afterall, we want to fix those (although it&#39;s rather hard with most of us not having a Mac).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Defined as &quot;a legacy system which cannot be upgraded or refactored and which must be built around until it can be replaced entirely&quot;. See the abandonment of Allegro 5.0 and instead the idea of building a new API over the existing one then gradually filtering out the old stuff.
</p></div></div><p>
Not sure if you followed why this is, but the reason the `rewrite Allegro 5 from scratch&#39; idea was dropped is that there is simply not enough manpower available to do it. No one has the time for a big undertaking like that.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 18 Aug 2005 19:00:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
This is somewhat sidetracking the original topic
</p></div></div><p>
I disagree, the topic had already begun &quot;the current implementation decisions affecting Allegro vs the ones we&#39;d like to see&quot;!</p><p>Anyway, since all of the concerns are already known or to be addressed after 4.2, things are looking up and as you point out, there isn&#39;t much utility in discussing them again.</p><p>Just one question, the answer to which I&#39;m sure has been made clear 1,000 times but which I never seem to grasp for very long: where can the API specs for 4.3 be found? Or are they the same as 5.0 was, but without a full rewrite underneath?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Thu, 18 Aug 2005 19:12:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
where can the API specs for 4.3 be found? Or are they the same as 5.0 was, but without a full rewrite underneath?
</p></div></div><p>
They&#39;re the same as for 5.0, the rationale being that a lot of work and thought was put into those and it&#39;d be a waste not to use it, or to just start over and reinvent all that was considered before.<br />That said, as things are implemented, issues may pop up that make it nescessary to discuss some things again. Some parts of the 5.0 spec may be so incomplete that we need to discuss them anyway.</p><p>About the `rewrite underneath&#39;, that is actually part of the plan, but it won&#39;t be a rewrite from scratch. Peter [Wang] has worked on the event subsystem, which replaces what was previously in place. There are also new keyboard drivers. I&#39;ve started on the graphics API, but it still lives on top of the old drivers. Eventually, those will have to go.<br />The internals will be rewritten, just not as one big chunk and it won&#39;t be done from scratch.<br />Right now, what has been done can really only be seen by checking the CVS commit logs, which isn&#39;t really ideal. We&#39;ll have to move to a detailed TODO/DONE list... after 4.2. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Thu, 18 Aug 2005 19:22:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
abstraction inversion<br />accidental complexity
</p></div></div><p>
Yes, that&#39;s all the reason why there will be a new version.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
busy waiting
</p></div></div><p>
This has two reasons. One is the current polling nature - so the only way around it is to insert rest(1). The other is that many programs simply don&#39;t put in rest(1) on purpose, fearing it will cause worse performance. The events system already implemented in new_api_branch solves this.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
code momentum<br />Created by things like rotate_stretch_pivot_bitmap as compared to the two other functions rotate_pivot_bitmap and stretch_bitmap. Which are all hypothetical because I don&#39;t have the Allegro manual to hand, but you get the point. Compare and contrast with OpenGL or DirectDraw, the former of which uses modal parameters and the latter uses, for the limited functions it has, states attached to objects.
</p></div></div><p>
I don&#39;t understand.. you mean, the API has too many functions?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
continuous obsolescence
</p></div></div><p>
As Evert pointed out, in the time of feature freeze before the next stable release after several years it really is wise to do nothing except fixing the existing things.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
creeping featurism
</p></div></div><p>
The problem is, many included things make it easier to use. But there haven&#39;t been any much new features added in a long time. Is there any new feature in 4.2.0 we didn&#39;t have in 4.0.0? I fully would support a move towards making Allegro more modular though.. even if we then have to package up all the modules again as a single package for anyone to be happy with it.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
procedural code
</p></div></div><p>
I don&#39;t see this. There&#39;s the long standing bitmap/sprite API problem, and some historic things like the 3D functions, to which this may apply - but the core drivers follow a very clean architecture.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
stovepipe system<br />Defined as &quot;a legacy system which cannot be upgraded or refactored and which must be built around until it can be replaced entirely&quot;. See the
</p></div></div><p>
Well, what is happening is, core parts are upgrade in new_api_branch, and the other code is constantly refactored.. so per your definition this doesn&#39;t apply to Allegro.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Just one question, the answer to which I&#39;m sure has been made clear 1,000 times but which I never seem to grasp for very long: where can the API specs for 4.3 be found? Or are they the same as 5.0 was, but without a full rewrite underneath?
</p></div></div><p>

I&#39;d like there to be a list of things which need to be done, and who is working on what.. my attemps can be seen in the wiki: <a href="http://awiki.strangesoft.net/bin/view/Main/AllegroDev">http://awiki.strangesoft.net/bin/view/Main/AllegroDev</a></p><p>There&#39;s not much there yet, but I guess that can be contributed to everyone being busy with 4.2.0 <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /> I will make sure to document what I want to work and am currently working on there once 4.2.0 is out. Or maybe 4.2.0 is just an excuse for my laziness, we&#39;ll see..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Fri, 19 Aug 2005 00:08:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Firstly, it&#39;s wild speculation that this particular thing is a speed issue,
</p></div></div><p> I got that part.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Secondly, Allegro is already a 90% bloat library for most people that being DOS-centric in design eats 100% CPU at runtime, can it really justify taking an unnecessarily gigantic chunk of memory as well?
</p></div></div><p>
Why not? If people ask we could use Pacman as a scapegoat.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Yes. Thing is, they&#39;re not allowed.
</p></div></div><p> I get that part too, but the person I was responding too didn&#39;t; he said something along the lines of &quot;If it lets you do it...&quot; and I said something along the lines of &quot;well if it lets us do it, then it should work&quot;</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Yes, no argument there.
</p></div></div><p> Umm if destroy_bitmap should destroy anything create_bitmap makes then create_bitmap should return NULL on passing (0,0) but you seem to be disagreeing on that item... not sure...  -- And I was unaware of NULL not crashing destroy_bitmap...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Fri, 19 Aug 2005 02:15:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
it would be very interesting to make a virtual middle layer Allegro DLL ... find out what proportion of the API is actually in common use
</p></div></div><p>.</p><p>my allegro C++ wrapper does func call counting, i get a nice chart at teh bottom of the log file that tells me which functions get (ab)used.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
don&#39;t put in rest(1) on purpose, fearing it will cause worse performance. The events system already implemented in new_api_branch solves this
</p></div></div><p>

&quot;solves&quot; or forces ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Sun, 21 Aug 2005 03:08:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
it would be very interesting to make a virtual middle layer Allegro DLL ... find out what proportion of the API is actually in common use
</p></div></div><p>
I&#39;d just use a profiler. That&#39;s (part of) what it&#39;s for, afterall.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 21 Aug 2005 03:12:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
&quot;solves&quot; or forces ?
</p></div></div><p>

Solves. You can always busy loop and poll for events with an event based API. It just would be stupid.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;d just use a profiler. That&#39;s (part of) what it&#39;s for, afterall.
</p></div></div><p>

Do we provide a profiling version for MSVC? It indeed sounds like AJ simply  wrote his own profiler..
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sun, 21 Aug 2005 03:27:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Do we provide a profiling version for MSVC?
</p></div></div><p>
Not sure. I don&#39;t think so, but it shouldn&#39;t matter for call counts.<br />If we don&#39;t, then how do people do speed comparisons between MinGW and MSVC? Allegro&#39;s test programme?</p><p>By the way, Elias, is reply-by-email working for you? It stopped working for me a while back, but it might be a problem on my end (didn&#39;t have time to look into it yet).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 21 Aug 2005 03:31:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">2005-08-20 at 22:31 +0000, Evert said:</div><div class="quote"><p>
Quote:<br />Do we provide a profiling version for MSVC?<br />Not sure. I don&#39;t think so, but it shouldn&#39;t matter for call counts.<br />If we don&#39;t, then how do people do speed comparisons between MinGW and<br />MSVC? Allegro&#39;s test programme?
</p></div></div><p>
Yes, I&#39;ve never seen profiler comparisons. It wouldn&#39;t be the best thing anyway, since each profiler produces overhead of its own. Some things really take much longer with the profile time, in my experience.</p><p>AJ: Do you know if MSVC supports profiling?</p><p>And related, I actually have no idea how well the debug version works in MSVC. Can you actually step through Allegro and view variable values and so on, like you can with gdb?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
By the way, Elias, is reply-by-email working for you? It stopped<br />working for me a while back, but it might be a problem on my end<br />(didn&#39;t have time to look into it yet).
</p></div></div><p>
Not sure, I mostly click the &quot;Go to post&quot; link - unless I mistake it as an [AD] post and then just reply. This is an email reply, in case it arrives.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Sun, 21 Aug 2005 03:42:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>for a long time i have wondered about the profiling build for MSVC, but never looked into it.  i figured that what would i do with such information if i had it, so i never bothered.</p><p>my own C++ allegro wrapper that does func call counting, was not its intended purpose, the function call counting was just a side effect of a method i was using to send real time function call entry times to a seperate analysis app i wrote to measure timing.</p><p>i have never bothered to look at allegro internal variables in the MSVC debugger, i presume you can.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Sun, 21 Aug 2005 07:35:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Yes, I&#39;ve never seen profiler comparisons. It wouldn&#39;t be the best thing anyway, since each profiler produces overhead of its own. Some things really take much longer with the profile time, in my experience.
</p></div></div><p>I think I&#39;ve heard from somewhere that MSVC licence forbids you to compare the compilers quality/speed with other compilers, at least in public. Thats the reason why there are so little comparisons of MSVC vs anything.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Mon, 22 Aug 2005 00:06:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think I&#39;ve heard from somewhere that MSVC licence forbids you to compare the compilers quality/speed with other compilers, at least in public.
</p></div></div><p>
<i>What</i>?!??!!?<br />That&#39;s just too much. I&#39;ll belief it when I see it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Mon, 22 Aug 2005 00:11:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Evert said:</div><div class="quote"><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think I&#39;ve heard from somewhere that MSVC licence forbids you to compare the compilers quality/speed with other compilers, at least in public.
</p></div></div><p>
What?!??!!?<br />That&#39;s just too much. I&#39;ll belief it when I see it.
</p></div></div><p>

<a href="http://msdn.microsoft.com/vstudio/productinfo/faq/default.aspx">http://msdn.microsoft.com/vstudio/productinfo/faq/default.aspx</a></p><p>&quot;Q. Can I benchmark the Microsoft .NET Framework?&quot;, near the bottom of the page.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Mon, 22 Aug 2005 00:20:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>what of the create_bitmap(0,0) problem, anything going to be done about it?</p><p><span class="source-code"><a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a><span class="k3">*</span> p <span class="k3">=</span> <a href="http://www.allegro.cc/manual/create_bitmap" target="_blank"><span class="a">create_bitmap</span></a><span class="k2">(</span> <span class="n">0</span>,<span class="n">0</span> <span class="k2">)</span><span class="k2">;</span></span></p><p>debug build msvc7 doesn&#39;t stop, doesn&#39;t do its assert thing, doesnt make an error, run it in debug mode, it just returns a !0 ptr.</p><p><img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Mon, 22 Aug 2005 09:01:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think I&#39;ve heard from somewhere that MSVC licence forbids you to compare the compilers quality/speed with other compilers, at least in public.
</p></div></div><p>

</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
<a href="http://msdn.microsoft.com/vstudio/productinfo/faq/default.aspx">http://msdn.microsoft.com/vstudio/productinfo/faq/default.aspx</a></p><p>&quot;Q. Can I benchmark the Microsoft .NET Framework?&quot;, near the bottom of the page.
</p></div></div><p>

.NET Framework != MSVC Compiler</p><p>.NET Frame is more of a &quot;library&quot; + Set of standards for the JIT Compiler; .NET apps are compiled into IL code (byte code basically) and when the app is run, the JIT Compiler compiles/caches/runs each part of the bytecode as it&#39;s needed, the only effeciency gained by this method is that the code can be optimized for every platform it&#39;s run on, the drawbacks are obvious.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Mon, 22 Aug 2005 09:27:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Micheal Jensen, your off topic.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (A J)</author>
		<pubDate>Mon, 22 Aug 2005 23:16:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">A J said:</div><div class="quote"><p>
Micheal Jensen, <b>your</b> off topic.
</p></div></div><p>
Yes, it is Michael&#39;s off topic post <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>Sorry, couldn&#39;t resist.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ReyBrujo)</author>
		<pubDate>Mon, 22 Aug 2005 23:27:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Actually, I think this thread has served its purpose too...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Tue, 23 Aug 2005 00:19:24 +0000</pubDate>
	</item>
</rss>
