Hacker News new | past | comments | ask | show | jobs | submit login

Good luck chasing bugs then, though. qsort() will be totally happy comparing apples to oranges - aka there is zero type safety.

Templates give you compile time type checking, that's why one doesn't pass void pointers like this anymore but uses templates to implement generic functions.




> Good luck chasing bugs then, though. qsort() will be totally happy comparing apples to oranges - aka there is zero type safety.

That's a fair point. However, I do not tend to make many of the mistakes that would be caught by the C++ type system. But different people tend to make different kinds of mistakes.

The type bugs that happen tend to be pretty obvious and easy to debug. Good luck to you debugging template code :) I've had a harder time debugging C++ code than C code. Again, YMMV.


I agree that YMMV.

Although sometimes "I do not tend to make many of the mistakes that would be caught by the C++ type system" might be related to "how to use C++ type system so it would catch mistakes people tend to make".




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

Search: