News for hackers. Stuff that matters.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by justinsb on Thursday August 30, 2012 @12:41PM (#4455455)
Right, but the same trade-offs apply to C; C++ is actually superior here: if something shouldn't be copied, you can enforce that in C++, but not in C.

The author was arguing that writing in C++/STL meant your code was necessarily less efficient than C; that just seems incorrect.

Edit: If you're referring to copying the person values when they're returned from the list: a reference is returned; the compiler will optimize that "pointer" away. Most C++ compilers can even do this when the value itself is returned and avoid the copy. My rule with C++ is that the compiler is stupid, but never where you expect. You need to optimize based on a profiler.

There are no comments on this comment yet.