News for hackers. Stuff that matters.
Re:C++14 and SDL2: Managing Resources by masklinn on Friday April 18, 2014 @02:19PM (#7610486)
> RAII is superior to this approach:

unique_ptr is not RAII now?

> 1. Easier to read

That's debatable, here ``make_resource`` has to be understood once and will thereafter work with any C constructor/destructor pair. Considering the tone of your comment I guess you mean wrapping each pair in its own object so each of these wrapper objects (and its ownership semantics) has to be understood, and at a fundamental level they're redundant with unique_ptr.

If you don't like the generic thingy and want one wrapper object per call pair, you can just typedef the unique_ptr.

> 2. Easier to use

Easier to use than calling a function and having a unique_ptr with clear ownership semantics?

Re:C++14 and SDL2: Managing Resources by mattgreenrocks on Friday April 18, 2014 @02:29PM (#7610532)
Don't appreciate your tone. Relax buddy, it's Friday.

I'm arguing for introducing thin abstractions over the underlying API to handle lifetime issues, and encapsulate icky, SDL-specific details and types as they arise.

They are definitely redundant with unique_ptr. In return, they're higher-level and more abstract. It's up to the developer to select what level they need to be at. I favor abstraction and readability, others may not.

Re:C++14 and SDL2: Managing Resources by masklinn on Friday April 18, 2014 @02:46PM (#7610605)
> Don't appreciate your tone. Relax buddy, it's Friday.

Wow, sorry, I didn't know you were an internet badass, that changes everything.

As for relaxing, have you considered taking your own advice?

> I'm arguing for introducing thin abstractions over the underlying API to handle lifetime issues, and encapsulate icky, SDL-specific details and types as they arise.

Yes, now that you point it out I can certainly see a careful balancing of the tradeoffs between having to maintain custom code versus the ability to create more extended abstractions in your summary declaration that unique_ptr is hard to read, hard to use and not RAII.

Re:C++14 and SDL2: Managing Resources by dang on Saturday April 19, 2014 @04:58PM (#7614696)
The comment you responded to was indeed inappropriately irritating. But please don't respond to incivility with more incivility on HN. It's hard not to, but it only makes things worse.