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."
Permalink for comment 548500
To read all comments associated with this story, please click here.
Member since:

Not at all.

1. I replaced the classical "for loop" for the range based for loop, that hides complexity and improves reading a lot.

2. I used shared_ptr<Object> instead of Object*, so I do not need to iterate through all the vector elements to release them; the shared_ptr does the job.

3. Since the shared_ptr<Object> is a value type (storing a pointer), if an exception occurs, the vector will invoke the Object destructors automatically, making my code exception-safe.

All of that and my code is smaller ;)

Reply Parent Score: 3