<?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: Smallest possible useful C++ Attribute system?</title>
	<atom:link href="http://meshula.net/wordpress/?feed=rss2&#038;p=172" rel="self" type="application/rss+xml" />
	<link>http://meshula.net/wordpress/?p=172</link>
	<description>Spaces Between</description>
	<lastBuildDate>Mon, 30 Aug 2010 08:23:36 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: air jordan 15</title>
		<link>http://meshula.net/wordpress/?p=172&#038;cpage=1#comment-7783</link>
		<dc:creator>air jordan 15</dc:creator>
		<pubDate>Tue, 06 Jul 2010 09:14:28 +0000</pubDate>
		<guid isPermaLink="false">http://meshula.net/wordpress/?p=172#comment-7783</guid>
		<description>Mark S. is definitely on the right track. If you want to get a professional looking email address, Id recommend buying your name domain name, like or  &lt;br&gt;&lt;a href=&quot;http://www.gucci-outlet-store.com&quot;  rel=&quot;nofollow&quot;&gt;gucci store&lt;/a&gt; &lt;br&gt; If its common it might be difficult to get, however, be creative and you can usually find something.</description>
		<content:encoded><![CDATA[<p>Mark S. is definitely on the right track. If you want to get a professional looking email address, Id recommend buying your name domain name, like or  <br /><a href="http://www.gucci-outlet-store.com"  rel="nofollow">gucci store</a> <br /> If its common it might be difficult to get, however, be creative and you can usually find something.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://meshula.net/wordpress/?p=172&#038;cpage=1#comment-7027</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 08 Nov 2008 20:40:30 +0000</pubDate>
		<guid isPermaLink="false">http://meshula.net/wordpress/?p=172#comment-7027</guid>
		<description>Note, further correspondence is here: http://www.realityprime.com/articles/the-audience</description>
		<content:encoded><![CDATA[<p>Note, further correspondence is here: <a href="http://www.realityprime.com/articles/the-audience" rel="nofollow">http://www.realityprime.com/articles/the-audience</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://meshula.net/wordpress/?p=172&#038;cpage=1#comment-6416</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 13 Jun 2008 06:43:29 +0000</pubDate>
		<guid isPermaLink="false">http://meshula.net/wordpress/?p=172#comment-6416</guid>
		<description>Adding a vector of base classes to the AttributeBinder, and a macro to declare them allows for reflection of singly-inherited classes. A scheme like this one works with single inheritance because subclass variables are simply added at the end of the base class. It doesn&#039;t work with multiple inheritance because the calculation of the offset of the base is more complex. It could be resolved with dynamic_cast, but I&#039;m moving this framework in the direction of not needing RTTI. Other schemes that would work with multiple inheritance introduce complexity, or overhead, and I&#039;m not satisfied introducing either.

Add to AttributeBinder:

	std::vector&lt;AttributeBinder*&gt; bases;

New macro:


#define BIND_BASE(c) \
	binding.bases.push_back(&amp;c::binding);


Example to extend Foo in the original post:

class Baz : public Foo
{
public:

	BIND_START;
	BIND_BASE(Foo);
	BIND(Baz, bool1, bool);
	BIND(Baz, int2, int);
	BIND(Baz, float3, float);
	BIND_END;

	Baz() : bool1(true), int2(2), float3(3) { }

	bool bool1;
	int int2;
	float float3;
};</description>
		<content:encoded><![CDATA[<p>Adding a vector of base classes to the AttributeBinder, and a macro to declare them allows for reflection of singly-inherited classes. A scheme like this one works with single inheritance because subclass variables are simply added at the end of the base class. It doesn&#8217;t work with multiple inheritance because the calculation of the offset of the base is more complex. It could be resolved with dynamic_cast, but I&#8217;m moving this framework in the direction of not needing RTTI. Other schemes that would work with multiple inheritance introduce complexity, or overhead, and I&#8217;m not satisfied introducing either.</p>
<p>Add to AttributeBinder:</p>
<p>	std::vector<attributebinder *> bases;</p>
<p>New macro:</p>
<p>#define BIND_BASE(c) \<br />
	binding.bases.push_back(&#038;c::binding);</p>
<p>Example to extend Foo in the original post:</p>
<p>class Baz : public Foo<br />
{<br />
public:</p>
<p>	BIND_START;<br />
	BIND_BASE(Foo);<br />
	BIND(Baz, bool1, bool);<br />
	BIND(Baz, int2, int);<br />
	BIND(Baz, float3, float);<br />
	BIND_END;</p>
<p>	Baz() : bool1(true), int2(2), float3(3) { }</p>
<p>	bool bool1;<br />
	int int2;<br />
	float float3;<br />
};</attributebinder></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://meshula.net/wordpress/?p=172&#038;cpage=1#comment-6412</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 10 Jun 2008 06:40:35 +0000</pubDate>
		<guid isPermaLink="false">http://meshula.net/wordpress/?p=172#comment-6412</guid>
		<description>Hi Alexey, useful comments! I have updated the AttributeBinder with your third point, here: 

http://meshula.net/wordpress/?p=174

There are several reasons that many programmers consider type_info evil for games. I suppose the most glaring one is that it is incompletely implemented or non-existant on consoles. The second most glaring reason would be the reason multiple inheritance is considered bad; resolution can involve searching a vtable and doing matching. I wanted to stay away from roll your own RTTI because I wanted to keep this example really simple; but roll your own RTTI is actually pretty simple, so I should probably just go ahead and do it. I single stepped through the RTTI comparison code and discovered that MSVC generates code that strolls through the vtable, and ultimately does a strcmp against the type names it discovers (I didn&#039;t dig deep enough to discover if the type name is baked into the code, or if it is constructed dynamically, which would be trebly 3vil). Vtable strolls and strcmps in game code freak me out, so I&#039;m sold on not using built-in RTTI.

I&#039;m still thinking of some light way to do polymorphic reflection. I&#039;ll post again when I have something I like.

Suggestions are welcome!</description>
		<content:encoded><![CDATA[<p>Hi Alexey, useful comments! I have updated the AttributeBinder with your third point, here: </p>
<p><a href="http://meshula.net/wordpress/?p=174" rel="nofollow">http://meshula.net/wordpress/?p=174</a></p>
<p>There are several reasons that many programmers consider type_info evil for games. I suppose the most glaring one is that it is incompletely implemented or non-existant on consoles. The second most glaring reason would be the reason multiple inheritance is considered bad; resolution can involve searching a vtable and doing matching. I wanted to stay away from roll your own RTTI because I wanted to keep this example really simple; but roll your own RTTI is actually pretty simple, so I should probably just go ahead and do it. I single stepped through the RTTI comparison code and discovered that MSVC generates code that strolls through the vtable, and ultimately does a strcmp against the type names it discovers (I didn&#8217;t dig deep enough to discover if the type name is baked into the code, or if it is constructed dynamically, which would be trebly 3vil). Vtable strolls and strcmps in game code freak me out, so I&#8217;m sold on not using built-in RTTI.</p>
<p>I&#8217;m still thinking of some light way to do polymorphic reflection. I&#8217;ll post again when I have something I like.</p>
<p>Suggestions are welcome!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexey</title>
		<link>http://meshula.net/wordpress/?p=172&#038;cpage=1#comment-6410</link>
		<dc:creator>Alexey</dc:creator>
		<pubDate>Mon, 09 Jun 2008 10:13:28 +0000</pubDate>
		<guid isPermaLink="false">http://meshula.net/wordpress/?p=172#comment-6410</guid>
		<description>Hi, Nick!
While I hardly imagine a code smaller than yours, I wonder if you can get rid of some disputable moments.
As far as I know, using std::type_info implies that compiler generated type information for polimorphic classes (/GR option for Microsoft complilers) which is considered evil by many programmers in the industry.
For inherited classes we need to extend functionality to take parent&#039;s attributes into account.
And by the way, do we really need to copy attribute names (twice in our case)? I think we can just leave them in static storage (probably we need to declare custom sort predicate for the map container in that case)...</description>
		<content:encoded><![CDATA[<p>Hi, Nick!<br />
While I hardly imagine a code smaller than yours, I wonder if you can get rid of some disputable moments.<br />
As far as I know, using std::type_info implies that compiler generated type information for polimorphic classes (/GR option for Microsoft complilers) which is considered evil by many programmers in the industry.<br />
For inherited classes we need to extend functionality to take parent&#8217;s attributes into account.<br />
And by the way, do we really need to copy attribute names (twice in our case)? I think we can just leave them in static storage (probably we need to declare custom sort predicate for the map container in that case)&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
