<?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 for Tim Martin&#039;s blog</title>
	<atom:link href="http://blog.asymptotic.co.uk/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.asymptotic.co.uk</link>
	<description>On the human side of software</description>
	<lastBuildDate>Fri, 25 Mar 2011 21:52:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>Comment on How to tell if you&#8217;re in a method in C++ by admin</title>
		<link>http://blog.asymptotic.co.uk/2011/03/how-to-tell-if-youre-in-a-method-in-c/comment-page-1/#comment-4930</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Fri, 25 Mar 2011 21:52:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=649#comment-4930</guid>
		<description>Question 1: Yes, but the question is really about the difference between code that&#039;s closely associate with a particular instance (has access to private members) and code that&#039;s not closely associated with any particular instance. Whether it&#039;s in a class or not is only really a heuristic.

Question 2: In actual fact most of the classes in our code follow a common protocol, so you could reasonably ask for quite a few members you could expect to be there. I won&#039;t go into proprietary details, but obviously each class has a name, and you can imagine that certain classes would have a property where every instance would have a globally-unique canonical human-readable identifier, which would be nice to have in the log.

Question 3: I&#039;m not sure I follow. I was anticipating a global logging function (probably an ostream actually) that can log whatever&#039;s passed to it, and class-local adapters that would package up instance-specific information and pass it to the generic logging code. The packing-up code would have to be duplicated to some extent.

I&#039;m not sure the duplication&#039;s as bad as I thought - I think you can play games with covariant return types and the Curiously Recurring Template Pattern that will avoid the need for downcasting. I&#039;m afraid the latter half of this post was rather rushed and lost its coherence, and I&#039;m sufficiently tired that I don&#039;t feel like going back and fixing things. I might write another post about CRTP at some point though.</description>
		<content:encoded><![CDATA[<p>Question 1: Yes, but the question is really about the difference between code that&#8217;s closely associate with a particular instance (has access to private members) and code that&#8217;s not closely associated with any particular instance. Whether it&#8217;s in a class or not is only really a heuristic.</p>
<p>Question 2: In actual fact most of the classes in our code follow a common protocol, so you could reasonably ask for quite a few members you could expect to be there. I won&#8217;t go into proprietary details, but obviously each class has a name, and you can imagine that certain classes would have a property where every instance would have a globally-unique canonical human-readable identifier, which would be nice to have in the log.</p>
<p>Question 3: I&#8217;m not sure I follow. I was anticipating a global logging function (probably an ostream actually) that can log whatever&#8217;s passed to it, and class-local adapters that would package up instance-specific information and pass it to the generic logging code. The packing-up code would have to be duplicated to some extent.</p>
<p>I&#8217;m not sure the duplication&#8217;s as bad as I thought &#8211; I think you can play games with covariant return types and the Curiously Recurring Template Pattern that will avoid the need for downcasting. I&#8217;m afraid the latter half of this post was rather rushed and lost its coherence, and I&#8217;m sufficiently tired that I don&#8217;t feel like going back and fixing things. I might write another post about CRTP at some point though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to tell if you&#8217;re in a method in C++ by Jack V.</title>
		<link>http://blog.asymptotic.co.uk/2011/03/how-to-tell-if-youre-in-a-method-in-c/comment-page-1/#comment-4896</link>
		<dc:creator>Jack V.</dc:creator>
		<pubDate>Thu, 24 Mar 2011 10:25:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=649#comment-4896</guid>
		<description>Stupid question #3: You say multiple stubs, but don&#039;t you need a global logging function anyway to be called from global functions, which can be declared the same place as the macro or the joint base interface class, so _is_ there redundency?</description>
		<content:encoded><![CDATA[<p>Stupid question #3: You say multiple stubs, but don&#8217;t you need a global logging function anyway to be called from global functions, which can be declared the same place as the macro or the joint base interface class, so _is_ there redundency?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to tell if you&#8217;re in a method in C++ by Jack V</title>
		<link>http://blog.asymptotic.co.uk/2011/03/how-to-tell-if-youre-in-a-method-in-c/comment-page-1/#comment-4880</link>
		<dc:creator>Jack V</dc:creator>
		<pubDate>Wed, 23 Mar 2011 23:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=649#comment-4880</guid>
		<description>Stupid question #2: what sort of gubbins are you talking about? Just the name of the class, or a pointer to it, or a detailed dump of the contents?</description>
		<content:encoded><![CDATA[<p>Stupid question #2: what sort of gubbins are you talking about? Just the name of the class, or a pointer to it, or a detailed dump of the contents?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to tell if you&#8217;re in a method in C++ by Jack V</title>
		<link>http://blog.asymptotic.co.uk/2011/03/how-to-tell-if-youre-in-a-method-in-c/comment-page-1/#comment-4879</link>
		<dc:creator>Jack V</dc:creator>
		<pubDate>Wed, 23 Mar 2011 23:00:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=649#comment-4879</guid>
		<description>Stupid question #1: You could think like a java programmer and put all your global functions into a class?</description>
		<content:encoded><![CDATA[<p>Stupid question #1: You could think like a java programmer and put all your global functions into a class?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on You should work for Arista by Judith M</title>
		<link>http://blog.asymptotic.co.uk/2011/02/you-should-work-for-arista/comment-page-1/#comment-4425</link>
		<dc:creator>Judith M</dc:creator>
		<pubDate>Tue, 01 Mar 2011 12:47:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=616#comment-4425</guid>
		<description>This sounds a great place to work - shame I am too old to apply.</description>
		<content:encoded><![CDATA[<p>This sounds a great place to work &#8211; shame I am too old to apply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Compile-time type identification by Matt</title>
		<link>http://blog.asymptotic.co.uk/2011/02/compile-time-type-identification/comment-page-1/#comment-4365</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 25 Feb 2011 11:05:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=620#comment-4365</guid>
		<description>You are right, this is a pain and there should be a standard way of it.

However, you can get closer to the ideal output.

You can use template specialisation to name common types, e.g.

&lt;code&gt;
template string TypeDecryptor::getName (void) { return &quot;int&quot;; }
template string TypeDecryptor&lt;MyClass &gt;::getName (void) { return &quot;MyClass&quot;; }
&lt;/code&gt;

You can also add per-toolchain support for demangling, e.g.

&lt;code&gt;
#if __GXX_ABI_VERSION &gt; 1000
#include 
template string TypeDecryptor::getName (void)
{
    int s;
    char *b (abi::__cxa_demangle (typeid (T).name (), NULL, NULL, &amp;s));
    //if (!b &#124;&#124; s) throw ...;
    return b;
}
#else
template string TypeDecryptor::getName (void) { return typeid (T).name (); }
#endif
&lt;/code&gt;

boost::units::detail::demangle does pretty much this.

Of course actually doing any of this is a pain in the ass.</description>
		<content:encoded><![CDATA[<p>You are right, this is a pain and there should be a standard way of it.</p>
<p>However, you can get closer to the ideal output.</p>
<p>You can use template specialisation to name common types, e.g.</p>
<p><code><br />
template string TypeDecryptor::getName (void) { return "int"; }<br />
template string TypeDecryptor&lt;MyClass &gt;::getName (void) { return "MyClass"; }<br />
</code></p>
<p>You can also add per-toolchain support for demangling, e.g.</p>
<p><code><br />
#if __GXX_ABI_VERSION &gt; 1000<br />
#include<br />
template string TypeDecryptor::getName (void)<br />
{<br />
    int s;<br />
    char *b (abi::__cxa_demangle (typeid (T).name (), NULL, NULL, &amp;s));<br />
    //if (!b || s) throw ...;<br />
    return b;<br />
}<br />
#else<br />
template string TypeDecryptor::getName (void) { return typeid (T).name (); }<br />
#endif<br />
</code></p>
<p>boost::units::detail::demangle does pretty much this.</p>
<p>Of course actually doing any of this is a pain in the ass.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on C++ pointer template parameters are weird by Jack V</title>
		<link>http://blog.asymptotic.co.uk/2011/02/c-pointer-template-parameters-are-weird/comment-page-1/#comment-4281</link>
		<dc:creator>Jack V</dc:creator>
		<pubDate>Sun, 20 Feb 2011 11:43:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=597#comment-4281</guid>
		<description>I&#039;m not as good at this as I should be, but possibilities that occur to me would be:

Using a static object to describe the type desired (Like, using a size object to define a fixed-size 2-d array, instead of giving two int parameters (?). Or using a string to give a class type a name at compile type, if for some reason the built in name or a static variable don&#039;t work (?)).

Having a class which relates to a specific object (eg. a multi-gigabyte-size class which you allocate just one one and have some classes which only ever refer to that particular instantiation (?)).

Although I don&#039;t know if they&#039;re even valid</description>
		<content:encoded><![CDATA[<p>I&#8217;m not as good at this as I should be, but possibilities that occur to me would be:</p>
<p>Using a static object to describe the type desired (Like, using a size object to define a fixed-size 2-d array, instead of giving two int parameters (?). Or using a string to give a class type a name at compile type, if for some reason the built in name or a static variable don&#8217;t work (?)).</p>
<p>Having a class which relates to a specific object (eg. a multi-gigabyte-size class which you allocate just one one and have some classes which only ever refer to that particular instantiation (?)).</p>
<p>Although I don&#8217;t know if they&#8217;re even valid</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to suppress Visual Basic and C++ generation in Sandcastle Help File Builder by adam</title>
		<link>http://blog.asymptotic.co.uk/software-development-log/suppress-visual-basic-and-c-generation-in-sandcastle-help-file-builder/comment-page-1/#comment-3944</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Fri, 21 Jan 2011 16:57:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?page_id=417#comment-3944</guid>
		<description>Had the same problem.  Thank you for saving me time.</description>
		<content:encoded><![CDATA[<p>Had the same problem.  Thank you for saving me time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The News is not a competition by Buster</title>
		<link>http://blog.asymptotic.co.uk/2010/11/the-news-is-not-a-competition/comment-page-1/#comment-3879</link>
		<dc:creator>Buster</dc:creator>
		<pubDate>Fri, 14 Jan 2011 02:12:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=536#comment-3879</guid>
		<description>It&#039;s sad the obsessed way our &quot;informed&quot; society focuses on the recency aspect of news. To be informed means to know what&#039;s important, not what&#039;s as new as ever possible. Was it Neil Postman in Technopoly who irked us to ask &quot;what&#039;s good&quot; instead of &quot;what&#039;s new&quot;?</description>
		<content:encoded><![CDATA[<p>It&#8217;s sad the obsessed way our &#8220;informed&#8221; society focuses on the recency aspect of news. To be informed means to know what&#8217;s important, not what&#8217;s as new as ever possible. Was it Neil Postman in Technopoly who irked us to ask &#8220;what&#8217;s good&#8221; instead of &#8220;what&#8217;s new&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The QWERTY keyboard by Gogo</title>
		<link>http://blog.asymptotic.co.uk/2010/12/the-qwerty-keyboard/comment-page-1/#comment-3878</link>
		<dc:creator>Gogo</dc:creator>
		<pubDate>Fri, 14 Jan 2011 02:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.asymptotic.co.uk/?p=581#comment-3878</guid>
		<description>Go ahead, paste some text and see for yourself. I&#039;m no avid Dvorak supporter, using a custom layout at the moment. You may disagree about some of the metrics and even then Colemak comes out even better than Dvorak but, still, QWERTY is just... see for yourself.

http://www.codesharp.co.uk/dvorak/</description>
		<content:encoded><![CDATA[<p>Go ahead, paste some text and see for yourself. I&#8217;m no avid Dvorak supporter, using a custom layout at the moment. You may disagree about some of the metrics and even then Colemak comes out even better than Dvorak but, still, QWERTY is just&#8230; see for yourself.</p>
<p><a href="http://www.codesharp.co.uk/dvorak/" rel="nofollow">http://www.codesharp.co.uk/dvorak/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Served from: blog.asymptotic.co.uk @ 2012-02-05 10:37:45 by W3 Total Cache -->
