<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>[A5] user event type constant 1024</title>
		<link>http://www.allegro.cc/forums/view/606364</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 11 Feb 2011 10:48:42 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I read in the docs that the minimum user event type value is 1024. Shouldn&#39;t this value be a constant?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Thu, 10 Feb 2011 17:00:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Not really, the idea is that you&#39;re supposed to use <span class="source-code"><a href="http://www.allegro.cc/manual/ALLEGRO_GET_EVENT_TYPE"><span class="a">ALLEGRO_GET_EVENT_TYPE</span></a></span> to create an event id. It supposedly should keep down on collisions.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Thu, 10 Feb 2011 17:19:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That, and you can add to it: AL_GET_EVENT_TYPE(...) + 1 etc for other events. Instead of trying to create a unique 4 letter word for each event.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Thu, 10 Feb 2011 17:27:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Thanks. Are 4 characters enough, I wonder? perhaps the event type should be 8 characters to minimize collisions?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (axilmar)</author>
		<pubDate>Thu, 10 Feb 2011 22:02:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>4 characters (they can be any number 0-255) gives you about 2-4 billion event types <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Thu, 10 Feb 2011 22:08:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, given that they are <i>characters</i> one&#39;s mind tends to gravitate towards <i>printable</i> characters (as in the example!), of which there are only about 60 that are likely to be used (some 12 million combinations). Among those, though, certain combinations are much more likely to collide than others.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Thu, 10 Feb 2011 22:11:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Possibly, but what can you do about it? 8 characters is excessive IMO. If you use 5 addons that use events, that&#39;s 5 (or should be) &quot;strings&quot;. If addons use their name for their event type (Super Fantastic Physics Library uses SFPL) then it&#39;s not really likely you&#39;ll get collisions... but not impossible. Not much you can do about it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Thu, 10 Feb 2011 22:54:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You can generate IDs dynamically on program startup, and not take any arguments at all. It hardly matters exactly what the identifier is anyway, does it?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Thu, 10 Feb 2011 23:12:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/606364/902769#target">X-G</a> said:</div><div class="quote"><p>You can generate IDs dynamically on program startup, and not take any arguments at all. It hardly matters exactly what the identifier is anyway, does it?
</p></div></div><p>

Would be very easy to do of course - I think the only argument against it was that you can&#39;t use switch/case any longer. Personally I would prefer dynamic ids as well though, even if there is no danger of collision in practice. E.g. if two GUI addons use event ids of (AL_GET_EVENT_TYPE(&#39;A&#39;, &#39;G&#39;, &#39;U&#39;, &#39;I&#39;) + n) with (n in 0..1000) then you likely would still never use both addons at the same time.</p><p>However, it just would feel much cleaner to prevent collisions in the first place.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Thu, 10 Feb 2011 23:47:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Just have an official system to request id blocks. We could call it AANA.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 10 Feb 2011 23:52:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Coincidentally, given that ALLEGRO_GET_EVENT_TYPE is (I assume) meant to be opaque, how exactly are you supposed to ensure that the resulting ID is not within Allegro&#39;s reserved range?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Thu, 10 Feb 2011 23:57:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I was asking about this constant before (1024 are reserved by allegro) but for different reasons. Maybe it would be good after all though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trent Gamblin)</author>
		<pubDate>Thu, 10 Feb 2011 23:59:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>People should just be more creative with their base event id (not restricted to printable characters, btw).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Fri, 11 Feb 2011 02:53:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>SiegeLord, why AANA?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ron Novy)</author>
		<pubDate>Fri, 11 Feb 2011 10:33:32 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://www.iana.org/">http://www.iana.org/</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 11 Feb 2011 10:39:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ahh... Now it makes sense.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Ron Novy)</author>
		<pubDate>Fri, 11 Feb 2011 10:48:42 +0000</pubDate>
	</item>
</rss>
