<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>void Nish(char* szBlog);</title>
	<atom:link href="http://voidnish.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://voidnish.wordpress.com</link>
	<description>Nish’s thoughts on MFC, C++/CLI and .NET</description>
	<lastBuildDate>Thu, 16 May 2013 13:12:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='voidnish.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>void Nish(char* szBlog);</title>
		<link>http://voidnish.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://voidnish.wordpress.com/osd.xml" title="void Nish(char* szBlog);" />
	<atom:link rel='hub' href='http://voidnish.wordpress.com/?pushpress=hub'/>
		<item>
		<title>DateTime projection in C++/CX</title>
		<link>http://voidnish.wordpress.com/2013/03/20/datetime-projection-in-ccx/</link>
		<comments>http://voidnish.wordpress.com/2013/03/20/datetime-projection-in-ccx/#comments</comments>
		<pubDate>Wed, 20 Mar 2013 19:39:27 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++/CX]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=407</guid>
		<description><![CDATA[C# projects Windows::Foundation::DateTime as System.DateTimeOffset, whereas C++ just exposes the raw structure. This can be rather unnerving if you are trying to port some C# code to C++/CX. All you have to work with is the UniversalTime property which is a long long that MSDN defines as the number of 100-nanosecond intervals prior to or [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=407&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>C# projects <code>Windows::Foundation::DateTime</code> as <code>System.DateTimeOffset</code>, whereas C++ just exposes the raw structure. This can be rather unnerving if you are trying to port some C# code to C++/CX. All you have to work with is the <code>UniversalTime</code> property which is a <code>long long</code> that MSDN defines as <i>the number of 100-nanosecond intervals prior to or after midnight on January 1, 1601</i>. Even a simple task as displaying a formatted date/time string is difficult as <code>ToString</code> merely returns the fully qualified name of the type. </p>
<p>Fortunately enough, <code>Windows::Globalization::DateTimeFormatting</code> includes the <code>DateTimeFormatter</code> class that can be used to get readable date/time display strings from a <code>DateTime</code> structure. Here&#8217;s some sample code that shows how you can use this.</p>
<pre class="brush: cpp; title: ; notranslate">auto dateFormatter = DateTimeFormatter::LongDate;
auto timeFormatter = DateTimeFormatter::LongTime;

for(auto item : feed-&gt;Items)
{   
  listBox-&gt;Items-&gt;Append(
    dateFormatter-&gt;Format(item-&gt;PublishedDate) + &quot; &quot; +
    timeFormatter-&gt;Format(item-&gt;PublishedDate) + &quot; - &quot; +  
    item-&gt;Title-&gt;Text);         
}</pre>
<p>Obviously, it&#8217;d have been heaps better if the compiler gave us easier to use projections, but it&#8217;s still not that bad. A common practice is to convert this to standard C++ or ATL/Win32 date structures and formats if you want to do additional date/time processing on the object. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/407/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/407/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=407&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2013/03/20/datetime-projection-in-ccx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Compiler errors when using the Bindable attribute</title>
		<link>http://voidnish.wordpress.com/2013/03/15/compiler-errors-when-using-the-bindable-attribute/</link>
		<comments>http://voidnish.wordpress.com/2013/03/15/compiler-errors-when-using-the-bindable-attribute/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 15:53:28 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++/CX]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=403</guid>
		<description><![CDATA[It&#8217;s been a long break for me from blogging, but I intend to make up for that over the next few months. I&#8217;ll primarily be blogging on topics mostly related to using Visual C++ to develop Windows Store applications. So if that&#8217;s the sort of thing that interests you, do check back once in a [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=403&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a long break for me from blogging, but I intend to make up for that over the next few months. I&#8217;ll primarily be blogging on topics mostly related to using Visual C++ to develop Windows Store applications. So if that&#8217;s the sort of thing that interests you, do check back once in a while.</p>
<p>Putting the <code>BindableAttribute</code> on a C++ ref class makes the class available for databinding. Unfortunately, if you add a very simple ref class and then mark it as <code>[Bindable]</code>, you&#8217;ll get some weird compiler error messages. Example &#8211; consider this simple bindable class defined in Restaurant.h.</p>
<pre class="brush: cpp; title: ; notranslate">namespace ViewModels
{
  [Windows::UI::Xaml::Data::Bindable] 
  public ref class Restaurant sealed
  {
  public:
  };
}</pre>
<p>Assume there&#8217;s a Restaurant.cpp that includes this file. You&#8217;ll get these compiler errors (or something close to it).</p>
<pre class="brush: plain; title: ; notranslate">Error 1 error C3083: 'ViewModels': the symbol to the left 
    of a '::' must be a type ...\xamltypeinfo.g.cpp 
Error 2 error C2039: 'Restaurant' : is not a member 
    of 'ViewModels' ...\xamltypeinfo.g.cpp 
Error 3 error C2061: syntax error : identifier 
    'Restaurant' ...\xamltypeinfo.g.cpp</pre>
<p>The not so obvious fix for these errors is to include Restaurant.h in any of your xxx.xaml.h files (right after the include to the xxx.g.h file would be a good place). This seems to be due to how the XAML compiler ties into the whole build process. Not a major hassle, but more something to be aware of.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/403/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/403/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=403&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2013/03/15/compiler-errors-when-using-the-bindable-attribute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual C++ WinRT FAQ – Winsock and other APIs</title>
		<link>http://voidnish.wordpress.com/2012/06/05/visual-c-winrt-faq-winsock-and-other-apis/</link>
		<comments>http://voidnish.wordpress.com/2012/06/05/visual-c-winrt-faq-winsock-and-other-apis/#comments</comments>
		<pubDate>Tue, 05 Jun 2012 14:15:23 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++/CX]]></category>
		<category><![CDATA[FAQ]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=399</guid>
		<description><![CDATA[When migrating apps or libraries that use sockets to WinRT, the absence of Winsock is often one of the first hurdles for many C++ devs. The suggested alternative to Winsock is to use the Windows.Networking.Sockets namespace. For a full list of alternate APIs that replace existing ones, see: Alternatives to Windows APIs in Metro style [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=399&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>When migrating apps or libraries that use sockets to WinRT, the absence of Winsock is often one of the first hurdles for many C++ devs. The suggested alternative to Winsock is to use the <code>Windows.Networking.Sockets</code> namespace. For a full list of alternate APIs that replace existing ones, see:</p>
<ul>
<li>
<a href='http://msdn.microsoft.com/en-us/library/windows/apps/hh464945.aspx' target='_blank'>Alternatives to Windows APIs in Metro style apps</a>
</li>
</ul>
<p>Be aware that you will most likely not get a one-to-one mapping for various API functions and structures. So you should fully expect to re-design and workaround that and use alternate approaches to achieving the same functionality/usability.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/399/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=399&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/06/05/visual-c-winrt-faq-winsock-and-other-apis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Difference between std::move and std::forward</title>
		<link>http://voidnish.wordpress.com/2012/05/22/difference-between-stdmove-and-stdforward/</link>
		<comments>http://voidnish.wordpress.com/2012/05/22/difference-between-stdmove-and-stdforward/#comments</comments>
		<pubDate>Tue, 22 May 2012 22:00:33 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[C++11]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=396</guid>
		<description><![CDATA[In really simple terms, std::move returns an argument as an rvalue reference while std::forward returns either an lvalue reference or an rvalue reference based on how the argument was passed in to the current function. While this is fairly obvious once you get the hang of it, it can be quite tricky to grasp earlier [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=396&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In really simple terms, <code>std::move</code> returns an argument as an rvalue reference while <code>std::forward</code> returns either an lvalue reference or an rvalue reference based on how the argument was passed in to the current function. While this is fairly obvious once you get the hang of it, it can be quite tricky to grasp earlier on. The easiest way to see how they work differently is to try some code such as the following:</p>
<pre class="brush: cpp; title: ; notranslate">void Show(int&amp;&amp;)
{
	cout &lt;&lt; &quot;int&amp;&amp; called&quot; &lt;&lt; endl;
}

void Show(int&amp;)
{
	cout &lt;&lt; &quot;int&amp; called&quot; &lt;&lt; endl;
}

template&lt;typename T&gt; void Foo(T&amp;&amp; x)
{
	cout &lt;&lt; &quot;straight: &quot;;
	Show(x);

	cout &lt;&lt; &quot;move: &quot;;
	Show(move(x));
	
	cout &lt;&lt; &quot;forward: &quot;;
	Show(forward&lt;T&gt;(x));
	
	cout &lt;&lt; endl;
}

int _tmain(void)
{
	Foo(10);

	int x=10;
	Foo(x);
	return 0;
}</pre>
<p>The output of the above code is:</p>
<pre class="brush: plain; title: ; notranslate">straight: int&amp; called
move: int&amp;&amp; called
forward: int&amp;&amp; called

straight: int&amp; called
move: int&amp;&amp; called
forward: int&amp; called</pre>
<p>When <code>Foo </code>is called with an rvalue, <code>T&amp;&amp;</code> is deduced as <code>int&amp;&amp;</code>. But the variable itself is an lvalue within that function. So the straight call calls the <code>Show(int&amp;)</code> overload &#8211; no surprises there. Both the move-call and the forward-call calls <code>Show(int&amp;&amp;)</code> as expected. In the 2nd case, <code>Foo </code>is called with an lvalue, and again the straight call will go to <code>Show(int&amp;)</code> while the move-call will go to <code>Show(int&amp;&amp;)</code>. Now here&#8217;s where <code>forward </code>comes in handy, it will go to <code>Show(int&amp;)</code> because that&#8217;s what <code>T</code> has been deduced to in this instance of the function call (perfect forwarding). If you are wondering why, the collapsing rule for <code>T&amp;&amp;</code> collapses it to <code>T&amp;</code> during template argument type deduction. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/396/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=396&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/05/22/difference-between-stdmove-and-stdforward/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Building Metro apps without Windows 8</title>
		<link>http://voidnish.wordpress.com/2012/05/15/building-metro-apps-without-windows-8/</link>
		<comments>http://voidnish.wordpress.com/2012/05/15/building-metro-apps-without-windows-8/#comments</comments>
		<pubDate>Tue, 15 May 2012 16:00:26 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[FAQ]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=393</guid>
		<description><![CDATA[This is an FAQ on the forums. And unfortunately but unsurprisingly, the answer is no, you cannot build a Metro app without Windows 8. If you are running Windows 7 and don&#8217;t want to risk screwing up your OS, you could install Windows 8 on a VM or dual-boot off a VHD/2nd partition. Those options [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=393&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is an FAQ on the forums. And unfortunately but unsurprisingly, the answer is no, you cannot build a Metro app without Windows 8. If you are running Windows 7 and don&#8217;t want to risk screwing up your OS, you could install Windows 8 on a VM or dual-boot off a VHD/2nd partition. Those options are reasonably performant, and more so if you have an SSD.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/393/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=393&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/05/15/building-metro-apps-without-windows-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>C# and the need (lack of) for move semantics</title>
		<link>http://voidnish.wordpress.com/2012/05/10/c-and-the-need-lack-of-for-move-semantics/</link>
		<comments>http://voidnish.wordpress.com/2012/05/10/c-and-the-need-lack-of-for-move-semantics/#comments</comments>
		<pubDate>Fri, 11 May 2012 01:00:42 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C#/.NET]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=390</guid>
		<description><![CDATA[Someone recently asked me why C# does not support move semantics. Well, C# mostly deals with references, so you don&#8217;t have to to deal with copy constructors called on temporary objects. C# does support value types too but they are nearly always used for POD (plain old data) types. And when there is the need [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=390&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Someone recently asked me why C# does not support move semantics. Well, C# mostly deals with references, so you don&#8217;t have to to deal with copy constructors called on temporary objects. C# does support value types too but they are nearly always used for POD (plain old data) types. And when there is the need for a copy, what&#8217;s usually done is to implement an interface such as <code>ICloneable</code>. In the C# (and .NET) world, assignments are mostly reference copies. A reference variable takes the value of another reference variable. In summary, C# as a language does not have a need for move semantics.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/390/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=390&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/05/10/c-and-the-need-lack-of-for-move-semantics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual C++ WinRT FAQ &#8211; Inter-Process-Communication</title>
		<link>http://voidnish.wordpress.com/2012/04/21/visual-c-winrt-faq-inter-process-communication/</link>
		<comments>http://voidnish.wordpress.com/2012/04/21/visual-c-winrt-faq-inter-process-communication/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 14:30:53 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++/CX]]></category>
		<category><![CDATA[FAQ]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=383</guid>
		<description><![CDATA[This is slightly related to the previous FAQ on connecting to localhost. While Metro apps can use contracts to communicate at some level with other apps, that is not equivalent to the traditional concept of inter-process communication. A metro app cannot communicate with a desktop app or even with another metro application on the same [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=383&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is slightly  related to the previous FAQ on connecting to localhost. While Metro apps can use contracts to communicate at some level with other apps, that is not equivalent to the traditional concept of inter-process communication. A metro app cannot communicate with a desktop app or even with another metro application on the same machine. </p>
<p>With desktop apps, the metro app cannot take for granted that it&#8217;s running or available, and thus it makes sense to not allow that. But you may be wondering why IPC is blocked between two metro apps. Well, metro apps can be in a suspended state at any given time, and there&#8217;s no sure way to predict its state. So even if there are two apps running at the same time, neither app can be sure if the other app&#8217;s ready to accept data or a command. This is quite likely why they decided to design it so that metro apps cannot talk to each other.</p>
<p>So, what&#8217;s the workaround? Again, the only reliable way an app can talk to another app on the same machine is to use a a 3rd service that&#8217;s running on the network, or to use a cliched phrase, use the cloud. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/383/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/383/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=383&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/04/21/visual-c-winrt-faq-inter-process-communication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual C++ WinRT FAQ &#8211; connecting to localhost</title>
		<link>http://voidnish.wordpress.com/2012/04/18/visual-c-winrt-faq-connecting-to-localhost/</link>
		<comments>http://voidnish.wordpress.com/2012/04/18/visual-c-winrt-faq-connecting-to-localhost/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 14:45:15 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++/CX]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=377</guid>
		<description><![CDATA[This is probably one of the most frequently asked questions on WinRT in the forums. The answer is &#8211; no, you cannot communicate with localhost. You can communicate with a service running on the local network, the intranet, or the internet. But you cannot connect to the loop back address. This is by design. It&#8217;s [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=377&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is probably one of the most frequently asked questions on WinRT in the forums. The answer is &#8211; <em>no</em>, you cannot communicate with localhost. You can communicate with a service running on the local network, the intranet, or the internet. But you cannot connect to the loop back address. This is by design. It&#8217;s a security measure, and also a side-effect of how a Metro app cannot take any assumptions about the machine it&#8217;s running on. And expecting a localhost service to be running is such an assumption. So what&#8217;s the alternative? Use the cloud <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>Note</strong>: you can connect to localhost for debugging, but your app will not be approved for publishing to the store. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/377/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/377/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=377&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/04/18/visual-c-winrt-faq-connecting-to-localhost/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual C++ WinRT FAQ – Non-RT types in public signature</title>
		<link>http://voidnish.wordpress.com/2012/04/11/visual-c-winrt-faq-non-rt-types-in-public-signature/</link>
		<comments>http://voidnish.wordpress.com/2012/04/11/visual-c-winrt-faq-non-rt-types-in-public-signature/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 17:45:10 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++/CX]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=369</guid>
		<description><![CDATA[Your public WinRT classes cannot use non-RT types in their public signature. This is something people run into very frequently when they start writing WinRT components. For example, see the code below. You&#8217;ll get a compiler error there: error C3986: 'Foo2': signature of member contains native type 'Native' Note that this is by design. (If [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=369&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Your public WinRT classes cannot use non-RT types in their public signature. This is something people run into very frequently when they start writing WinRT components. For example, see the code below.</p>
<pre class="brush: cpp; title: ; notranslate">class Native { };

public ref class MyRef sealed
{
private:
        voidFoo1(Native n) { } // &lt;--This is fine

public:
        voidFoo2(Native n) { } // &lt;--This won't compile
};</pre>
<p>You&#8217;ll get a compiler error there:</p>
<pre>error C3986: 'Foo2': signature of member contains native type 'Native'</pre>
<p>Note that this is by design. (If you think about it, it&#8217;s perfectly logical, since WinRT components can be consumed by any WinRT caller including non-C++ ones)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/369/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=369&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/04/11/visual-c-winrt-faq-non-rt-types-in-public-signature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual C++ WinRT FAQ – WRL vs C++/CX</title>
		<link>http://voidnish.wordpress.com/2012/03/30/visual-c-winrt-faq-wrl-vs-ccx/</link>
		<comments>http://voidnish.wordpress.com/2012/03/30/visual-c-winrt-faq-wrl-vs-ccx/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 15:30:42 +0000</pubDate>
		<dc:creator>Nish</dc:creator>
				<category><![CDATA[C++/CX]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://voidnish.wordpress.com/?p=363</guid>
		<description><![CDATA[As I said in my previous blog entry, WRL is a non-extension-based ISO compliant alternative to using C++/CX when targeting WinRT. They are both far easier to use than using straight COM, so what do you choose to use for your Visual C++ WinRT needs. In his talks, Herb Sutter has very strongly recommended that [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=363&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As I said in my previous blog entry, WRL is a non-extension-based ISO compliant alternative to using C++/CX when targeting WinRT. They are both far easier to use than using straight COM, so what do you choose to use for your Visual C++ WinRT needs. In his talks, Herb Sutter has very strongly recommended that we use C++/CX. And it&#8217;s fairly obvious that C++/CX is far simpler to use than WRL, specially when creating components (consuming components is relatively easier).</p>
<ul>
<li>The big thing with WRL is that you can use ISO C++. You don&#8217;t have to learn a new syntactic extension that you cannot use outside the Microsoft-world. Most C++ devs would feel comfortable using WRL, specially if they&#8217;ve used ATL before. That said portability is a myth, since WRL code is as tied into Windows as would be C++/CX code.</li>
<li>Do you want to totally avoid exceptions (perhaps to remain in sync with existing code that doesn&#8217;t use exceptions)? If so, you have to use WRL since C++/CX uses exceptions.</li>
<li>Performance wise, will you see any difference? As stated above, C++/CX uses exceptions while WRL uses HRESULTs. So the performance implications of using exceptions will obviously come into play. There is also the non-trivial conversion between HRESULTs and RT exceptions. Outide of that, I don&#8217;t think there&#8217;s going to be any noticable difference in performance</li>
<li>Not sure to what extent you can do this, but since WRL exposes the underlying COM architecture, you can fine-tune your code to some degree (since WinRT is built on top of COM). I haven&#8217;t read or heard about any scenarios where this has actually made a difference.</li>
<li>The psycological aspect. While this is the least technical of the reasons, it might be the biggest factor here. Many C++ devs would simply hate anything that they see as foreign syntax. And C++/CX is certainly not ISO C++. Its close similarity with C++/CLI (which many C++ devs found disgusting) doesn&#8217;t help either. If your C++ dev team comprises mainly of a bunch of these guys, I reckon it&#8217;d be wise to just use WRL.</li>
</ul>
<p>And personally speaking, I&#8217;d probably recommend that you learn to use both C++/CX and WRL. That way you can use what&#8217;s best for your specific scenario. And finally, you can mix WRL and C++/CX in the same project.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/voidnish.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/voidnish.wordpress.com/363/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=voidnish.wordpress.com&#038;blog=19268&#038;post=363&#038;subd=voidnish&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://voidnish.wordpress.com/2012/03/30/visual-c-winrt-faq-wrl-vs-ccx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4e6b0b5f2c4f588357ca1bdc9e77aabf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">voidnish</media:title>
		</media:content>
	</item>
	</channel>
</rss>
