|
|
|
|
|
by mreiland
4379 days ago
|
|
I didn't read all of his examples, but I read a few. I'm confused by his issue with calling virtual functions from the constructor. Because of the order in which C++ calls the constructors in a base/parent class hierarchy during construction, calling a virtual function can be dangerous. This is a valid restriction in my opinion. I get that it doesn't have to result in problems, and it can be useful, but in general, the guidelines in that section of the article coincide with whats generally considered good C++ code anyway. The example about the copy constructor being disabled by default. That's pretty sane in my opinion, some of the downsides to C++ are that sometimes you can't tell what's going on when looking at an innocuous statement such as 'a=b'. This policy just greatly tamps down on the possibility of C++ hiding a heck of a lot of 'magic' from you by doing things you didn't necessarily expect. I'm sure there are others, but honestly it feels more like the guy has a problem with Java than C++. |
|
He wasn't complaining about not calling virtual functions in ctors/dtors; he said that was understandable. He was complaining about two-stage initialization being required for any non-trivial initialization.