Re:Why do C++ folks make things so complicated?
by asher on Friday December 30, 2011 @10:08PM
(#3409987)
Well IIRC it was a tempting way to replace for-loops with direct list operations ala Python, Ruby etc. But the amount of syntactic noise and cognitive load seemed too much for the added leverage.
Our code had sufficient complexity that I didn't want one more oddity (as many would see it) to explain.
But for a small team, or a team that's all on the same page, maybe it's good.
Sorry to say there's no dramatic story of code explosion here!
Re:Why do C++ folks make things so complicated?
by FooBarWidget on Saturday December 31, 2011 @05:03AM
(#3410599)
I wouldn't use it for for-loops either, but man, boost::bind is so handy when compiled with boost::function! I used to use function pointers and 'void *userData'. If I wanted to pass additional data to the function then I have to allocate a structure and not forgetting to free it later which resulted in a lot of boilerplate code.
I used boost::bind and boost::function in VC6 code of all places and I thought that the resulting code turned out to be pretty decent (I think newer compilers let you use slightly less verbose syntax), and I really liked having the functionality of being able to pre-bind certain arguments. For example, I had a menu item click handler that I was able to bind a call to a unary method, but with different parameters. I thought the resulting code was simpler overall (and easier to refactor).