Why are constructors with one argument by default not made explicit?
1 answer
Here and Stroustrup in some book regretted it :) But ...
Do you know this Hochma - that the diameter of the spacecraft tanks is determined by the size of horse groats in ancient Rome?
And here it is - the initial decision, when explicit not in sight, and a sharp turn "all of a sudden" will lead to a violation of the backward compatibility and inoperability of a large number of already written code.
"I think so" (c) Pooh
- But you can also change this in the new standard, for example, marking as outdated - stack
- oneThis is the case when the transition is gradually impossible. As with
auto, they just didn’t use it :) You can cancelexplicitand enterimplicit, but change the usual code for the opposite meaning, where nothing is used? ... And the question is certainly not for me, I am not in any standardization committee I enter. And then ... It remains only to shrug and say "Well, so if Straustrup himself could not do anything ..." :) - Harry - @Harry, I probably misunderstood something, but as if for the cases template <class B, class T> void f () {B b (arg); b = T (); } and do not need to do this ... What do you think? - AR Hovsepyan
- one@ARHovsepyan Now I misunderstood. I want to say that there is a lot of code that relies on implicit type conversion due to the presence of appropriate constructors, and if you change the behavior of such constructors — so that these conversions are no longer valid — you will have to redo the mass of code ... Imagine for a second, What happens if, for example,
overriderequired? :) - Harry - @Harry, but now I understand, thanks for the answer. Getting old, nothing can be done .... - AR Hovsepyan
|