Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 10 Apr 2005
Offline Last Active Dec 10 2014 06:50 AM

Posts I've Made

In Topic: "defer": is this silly / broken?

09 December 2014 - 04:55 PM

I don't get people's problems in this thread. rolleyes.gif

All that needs to be said is that you reinvented scope exit. It has been proposed by Andrei Alexandrescu and it has made it into Facebooks folly library, so clearly some people find it valuable. There is nothing wrong with reinvention - and I think you're in good company with Andrei. Of course, as you can see in folly's implementation, a production quality version is a bit more involved, so ultimately it would be better to use that rather than roll your own.


In Topic: Critique my approach to writing RAII wrappers

08 September 2014 - 09:14 PM

So this thread went from "How is my RAII" to "What the hell is RAII". Interesting comments.

Yes, I contemplated whether I should step in, but I figured I will just let the discussion go. I don't really see the point of trying to (re-)define what RAII is. As SmkViper pointed out, the man who invented it has written extensively about it. Sure, there are nuances and different interpretations, but what I am interested in is a workable solution for wrapping C libraries like SDL, OpenGL, etc.

In Topic: Critique my approach to writing RAII wrappers

04 September 2014 - 07:09 PM

Initializtion does not mean resource allocation.  Initialization means a minimal empty valid state.

First, I wanted to highlight that I intentionally did not implement RAII in the Texture class. It is merely wraps a plain handle and adds convenience wrappers. I might as well have called it TextureHandle or something like that. The RAII comes into play when you use this class in conjunction with Unique, which puts the object into a valid initialised state on construction. To sum it up: int* is not RAII, but std::unique_ptr<int> is RAII. Similarly, Texture is not RAII, but Unique<Texture> is RAII.

Edit: Upon re-reading your post, I may have misinterpreted it the first time. Are you suggesting that it should be possible to create a Unique<Texture> without creating an OpenGL texture object? I must say I tend to agree. I suppose creating it in an empty state and having a makeUnique method which calls Texture::New similar to those in the standard library would be preferable.

In Topic: BMX Ride - Upcoming bmx game for the PC

20 July 2014 - 10:56 PM

That looks pretty sweet on the Rift. Level based on Danny MacAskill's Imaginate? Good work!

In Topic: OculusVR acquired and open sourced RakNet

07 July 2014 - 10:33 PM

Wow, didn't see that one coming. Good stuff!