Linked by MOS6510 on Thu 10th Jan 2013 23:25 UTC
General Development "For years I've tried my damnedest to get away from C. Too simple, too many details to manage, too old and crufty, too low level. I've had intense and torrid love affairs with Java, C++, and Erlang. I've built things I'm proud of with all of them, and yet each has broken my heart. They've made promises they couldn't keep, created cultures that focus on the wrong things, and made devastating tradeoffs that eventually make you suffer painfully. And I keep crawling back to C."
Thread beginning with comment 548640
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[8]: Point by point
by ingraham on Sun 13th Jan 2013 19:35 UTC in reply to "RE[7]: Point by point"
ingraham
Member since:
2006-05-20

if you write a thin wrapper on top of qsort that takes in a function pointer with more specific argument types, then the compiler will complain reliably.


That sounds obvious now that you mention it, but in over 20 years of C programming that never occurred to me, nor have I ever seen anybody do it. Of course, it adds that much more complexity, but it still sounds like a damn good idea.

Reply Parent Score: 1

RE[9]: Point by point
by kwan_e on Mon 14th Jan 2013 01:07 in reply to "RE[8]: Point by point"
kwan_e Member since:
2007-02-18

Of course, it adds that much more complexity


I find I have to write wrappers around a lot of library functions in any language. Maybe except for Python, with it's "batteries included" principle.

The C++ STL has a boatload of generic algorithms that provide typed sorting that qsort lacks.

http://www.cplusplus.com/reference/algorithm/

Templates keeps all the complexity in compile time.

Reply Parent Score: 2