6 ms·
Scott Meyers points out that one of the simplest possible refactorings is "rename method". To rename f(), you need to know what f() is, and in C++, f() can be a
by bumbledraven 9y ago
Scott Meyers points out that one of the simplest possible refactorings is "rename method". To rename f(), you need to know what f() is, and in C++, f() can be any of 7+ different things! [0] It's extremely complicated to determine which thing it is.
But according to TFA, people who prefer C are just being emotional and irrational.
[0] Scott Meyers. Things that Matter - DConf2017 [@27:51]
(https://youtu.be/RT46MpK39rQ?t=27m51s https://youtu.be/RT46MpK39rQ?t=27m51s)
- sqeaky 9y agoIn some obscure technical sense you might be correct, that identifying some piece of code is hard, but that little of C++ obscurantism is rarely why code isn't easy to read. With C++ it easier to express higher level concepts. I can have a map of strings to some class instance. Then I can use some string to lookup class instances. There are simple idiomatic ways to do this. They are short to writes (<10 lines), they will have decent performance and will be low on bugs and clear ownership semantics. With C it is common to have an array of pointer to pointer to void pointers. To get associative lookup it might be even worse and have functions that need to pointer to pointers, with who knows what ownership model and what idioms in use.