Re:Why should I have written ZeroMQ in C, not C++
by evincarofautumn on Thursday May 10, 2012 @12:13PM
(#3954259)
Typically what I do in that situation is lightly wrap the API. For instance:
That certainly can’t work everywhere, but I have yet to be failed by it.
[ Parent
| on HN ]
You can reduce verbosity of the code by passing destructor function directly to unique_ptr constructor:
std::unique_ptr<Image, void (*)(Image *)>(image, deallocate_image);
Re:Why should I have written ZeroMQ in C, not C++
by evincarofautumn on Friday May 11, 2012 @12:40PM
(#3960065)
Cool, thanks for the tip. I meant to offer an example for the general case.
Re:Why should I have written ZeroMQ in C, not C++
by jongraehl on Thursday May 10, 2012 @07:18PM
(#3956672)
People who don't do this are just asking for it.
Re:Why should I have written ZeroMQ in C, not C++
by malkia on Thursday May 10, 2012 @11:27PM
(#3957460)
That's a lot of boilerplate code. Okay there are macros to wrap such things, but I guess it's things like this that would make the future reader of the code puzzled.