Wear a Hat (^) when you do that thing, if that thing is Object References

You weren’t thinking that I was talking about something else were you?  Some people might call the ^ a carat, but in our world, it is a hat.  Use the “Hat” or ^ only if you are using with Windows Runtime Objects or are creating a Windows Runtime component.

(Keep in mind that there are WinRT API objects AND WinRT objects that you create, or I create).

Why use the “Hat” or “^” ?  Seriously, it’s garbage.  Really that is why, you use it to do garbage collection or automatic deletion for those of you that get a twitch whenever Microsoft mentions garbage collection.  See you DON’T have to use the Garbage Collection or Automatic Deletion for anything other than WinRT, all other C++ function just like you would expect it to.

This means you use the “Hat” or “^” instead of AddRef or Release with Windows Runtime, but it might be confusing about the difference between C++ and C#/VB.  As expected C++/CX compile directly to run directly on the CPU.  C#/VB compile to the MS intermediate language and execute in the Common Language Runtime (CLR).  And then JavaScript simply execute in the run-time.  VB, C# and C++ all communicate with the run-time presentation through the Application Binary Interface.

So what about C?  Yeah, there is way to use C.  I don’t want to talk about that right now, ok?

Then there is the Windows Metadata (.winmd) files, just to confuse everyone

WTF, or What’s the file?  The file is .winmd, which compiled at the same time as the Metro App.  Since JavaScript, C# and VB don’t know what C++ is doing when you use regular classes, arrays, templates or STL containers, .winmd makes the connection.

Wow a lot of stuff to learn about.

Comments (2)

  1. Simon says:

    Why are all the posts covered in this winrt rubbish, I don't know anyone intending to use it…  and what happened to xna?

  2. Surf4Fun says:


    Thank you for the comment!  XNA will be supported through MonoGame which will allow you to build using your XNA code I have been told.  As to WinRT, this is a simpler version of COM.  It allows C++ programmers to implement code that can be consumed by JavaScript.

    However, I would suggest that you consider moving to C++ and DirectX for your game design for Windows 8.  Once you get around all of the weird casing and endless annoying constants, as well the high level of complexity, C++ is pretty friendly.  Ok, not really, but the reality is that C++ is a reality and it is the basis of most codebases.  And you need to connect it to a useful presentation while maintaining all of the utility items for the rest of time.  Got it? Society simply is not producing enough C++ programmers.  Not close.

    I am afraid that a few months ago I would agree with you, but I gained insight that C++ programmers are a bigger group of programmers and programs then any other group.  Ignoring this large majority of programmers isn't a good idea.

    COM using the Managed Framework is easy, COM using C++ is more difficult.  COM using C++ and WinRT is easy.  This means that JavaScript can now access, safely, the CPU more directly in Windows 8 across all products.  COM using C is nearly impossible for normal people, COM using WinRT and C is much easier, in a relative sense.

Skip to main content