Nish's Blog
For several years I hosted my blog on my personal domain, but it got too tiring to keep maintaining WordPress every time they released a bug-fix or an update. So I finally moved it to WordPress.com.
Recent blog entries
DateTime projection in C++/CX
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 […]
Compiler errors when using the Bindable attribute
It’s been a long break for me from blogging, but I intend to make up for that over the next few months. I’ll primarily be blogging on topics mostly related to using Visual C++ to develop Windows Store applications. So if that’s the sort of thing that interests you, do check back once in a […]
Visual C++ WinRT FAQ – Winsock and other APIs
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 […]
Difference between std::move and std::forward
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 […]
Building Metro apps without Windows 8
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’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 […]
C# and the need (lack of) for move semantics
Someone recently asked me why C# does not support move semantics. Well, C# mostly deals with references, so you don’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 […]
Visual C++ WinRT FAQ – Inter-Process-Communication
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 […]
Visual C++ WinRT FAQ – connecting to localhost
This is probably one of the most frequently asked questions on WinRT in the forums. The answer is – 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’s […]
Visual C++ WinRT FAQ – Non-RT types in public signature
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’ll get a compiler error there: error C3986: 'Foo2': signature of member contains native type 'Native' Note that this is by design. (If […]
Visual C++ WinRT FAQ – WRL vs C++/CX
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 […]