Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: