News for hackers. Stuff that matters.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by 430gj9j on Thursday August 30, 2012 @12:51PM (#4455511)
No copying here:

  struct person { int age; };
  std::list<person> people;
  people.push_back(person());
  people.back().age = 42;
Re:Why should I have written ZeroMQ in C, not C++ (part II) by archangel_one on Thursday August 30, 2012 @03:15PM (#4456254)
It copies on the third line prior to C++0x, and unfortunately not everyone can rely on move semantics yet.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by mpyne on Thursday August 30, 2012 @03:24PM (#4456289)
Actually in this particular case that "copy" is allowed to be elided even in C++98, as the copy constructor of person produces no side effects. It would be hard to notice if the optimizer is that smart or not either way though, since it will be optimized by redundant load/store elimination even if it was initially generated without optimization.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by malkia on Thursday August 30, 2012 @04:14PM (#4456511)
And that's the other reason of not using C++ sometimes - you just don't know exactly what happens.