<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Is this a safe pattern for auto-registration?</title>
	<atom:link href="http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/</link>
	<description>game dev blog</description>
	<lastBuildDate>Mon, 11 Mar 2013 17:20:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: philhassey</title>
		<link>http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/comment-page-1/#comment-23603</link>
		<dc:creator>philhassey</dc:creator>
		<pubDate>Thu, 27 Oct 2011 18:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.philhassey.com/blog/?p=994#comment-23603</guid>
		<description>@dukope good call.  Explicit is always better than implicit.

@Danyal the first approach actually added stuff to a vector prior to main() being called by using static / global variables.</description>
		<content:encoded><![CDATA[<p>@dukope good call.  Explicit is always better than implicit.</p>
<p>@Danyal the first approach actually added stuff to a vector prior to main() being called by using static / global variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danyal</title>
		<link>http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/comment-page-1/#comment-23602</link>
		<dc:creator>Danyal</dc:creator>
		<pubDate>Thu, 27 Oct 2011 05:22:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.philhassey.com/blog/?p=994#comment-23602</guid>
		<description>Don&#039;t the two approaches do the same thing? I don&#039;t see what was automatic about the first approach. But then, I am a bit slow.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t the two approaches do the same thing? I don&#8217;t see what was automatic about the first approach. But then, I am a bit slow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dukope</title>
		<link>http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/comment-page-1/#comment-23601</link>
		<dc:creator>dukope</dc:creator>
		<pubDate>Thu, 27 Oct 2011 05:19:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.philhassey.com/blog/?p=994#comment-23601</guid>
		<description>Actually, one change I&#039;d suggest is this:

#define DOINIT(v) void v(Game &amp;g);v(g);

void game_init(Game &amp;g) {
DOINIT(levplay_init);
DOINIT(levedit_init);
}

... So when you search the code for levplay_init, it has two hits: the function itself and the call from game_init. Otherwise at some point in the future (speaking from experience here), you&#039;ll spend a few moments confused about why your levedit_init function isn&#039;t referenced from anywhere and it&#039;ll take a callstack to figure it out.</description>
		<content:encoded><![CDATA[<p>Actually, one change I&#8217;d suggest is this:</p>
<p>#define DOINIT(v) void v(Game &amp;g);v(g);</p>
<p>void game_init(Game &amp;g) {<br />
DOINIT(levplay_init);<br />
DOINIT(levedit_init);<br />
}</p>
<p>&#8230; So when you search the code for levplay_init, it has two hits: the function itself and the call from game_init. Otherwise at some point in the future (speaking from experience here), you&#8217;ll spend a few moments confused about why your levedit_init function isn&#8217;t referenced from anywhere and it&#8217;ll take a callstack to figure it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dukope</title>
		<link>http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/comment-page-1/#comment-23600</link>
		<dc:creator>dukope</dc:creator>
		<pubDate>Thu, 27 Oct 2011 05:12:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.philhassey.com/blog/?p=994#comment-23600</guid>
		<description>That would be my suggestion as well. Way easier to manage an explicit list of system inits in one place. Both for dependencies and code clarity, I think your second solution is much better.</description>
		<content:encoded><![CDATA[<p>That would be my suggestion as well. Way easier to manage an explicit list of system inits in one place. Both for dependencies and code clarity, I think your second solution is much better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philhassey</title>
		<link>http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/comment-page-1/#comment-23598</link>
		<dc:creator>philhassey</dc:creator>
		<pubDate>Wed, 26 Oct 2011 18:11:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.philhassey.com/blog/?p=994#comment-23598</guid>
		<description>After a bit of thought, this all seems like a misguided idea.

This seems much safer and more predictable.  It&#039;s not &quot;automagic&quot; but it requires less keystrokes to attain the same effect.  So that&#039;s more of a win in my book.

#define DOINIT(v) void v##_init(Game &amp;g);v##_init(g);

void game_init(Game &amp;g) {
    DOINIT(levplay);
    DOINIT(levedit);
}</description>
		<content:encoded><![CDATA[<p>After a bit of thought, this all seems like a misguided idea.</p>
<p>This seems much safer and more predictable.  It&#8217;s not &#8220;automagic&#8221; but it requires less keystrokes to attain the same effect.  So that&#8217;s more of a win in my book.</p>
<p>#define DOINIT(v) void v##_init(Game &#038;g);v##_init(g);</p>
<p>void game_init(Game &#038;g) {<br />
    DOINIT(levplay);<br />
    DOINIT(levedit);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mykhailo</title>
		<link>http://www.philhassey.com/blog/2011/10/26/is-this-a-safe-pattern-for-auto-registration/comment-page-1/#comment-23597</link>
		<dc:creator>Mykhailo</dc:creator>
		<pubDate>Wed, 26 Oct 2011 18:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.philhassey.com/blog/?p=994#comment-23597</guid>
		<description>I think it should work just fine. As another approach for auto registration I saw, it was usage of intrusive list and adding current object to the list in constructor.</description>
		<content:encoded><![CDATA[<p>I think it should work just fine. As another approach for auto registration I saw, it was usage of intrusive list and adding current object to the list in constructor.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
