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 548453
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Point by point
by ingraham on Fri 11th Jan 2013 22:22 UTC in reply to "RE: Point by point"
ingraham
Member since:
2006-05-20

You are positing a hypothetical question and drawing conclusions without any data to show for it.


Fair enough. I stand by the basic premise, however. Using function pointers to pass a compare function to a sort function is more complicated than blah.sort(). Particularly if your collection has a natural sort order, like strings.

"const *char" isn't a valid C construct.


Ha! Okay, it was 4 in the morning when I wrote that, but the fact that I screwed up my example kinda proves the point.

Reply Parent Score: 2

RE[3]: Point by point
by kwan_e on Sat 12th Jan 2013 00:20 in reply to "RE[2]: Point by point"
kwan_e Member since:
2007-02-18

Using function pointers to pass a compare function to a sort function is more complicated than blah.sort(). Particularly if your collection has a natural sort order, like strings.


The point of passing a compare function to a sort function is for when you want to sort things into a different order than the natural one.

Reply Parent Score: 2

RE[4]: Point by point
by ingraham on Sat 12th Jan 2013 04:44 in reply to "RE[3]: Point by point"
ingraham Member since:
2006-05-20

The point of passing a compare function to a sort function is for when you want to sort things into a different order than the natural one.


Except in C, there is no way to sort anything without passing a compare function to qsort. Even an array of ints needs a hand-coded, if trivial, compare function passed to it.

Reply Parent Score: 2