On Friday, 6 September 2013 at 11:32:11 UTC, Benjamin Thaut wrote:
Am 06.09.2013 13:27, schrieb Dicebot:
On Friday, 6 September 2013 at 11:04:31 UTC, Peter Alexander wrote:
Implicit conversions open up a whole can of worms for the sake of a
small amount of convenience.

I'm not sure it's a fair trade.

Agreed. It was quite common source of troubles in my C++ days and have
never offered much convenience.

Its only a source of troubles in C++ because it is the default behavior. But if you design a library it can make the usage of your api easier and also you have a few more options to stay backwards compatible with your old api.

Totally agree. The default implicit conversion in C++ is a mistake.

The conversion must be explicit by default (like in D now).
The programmer should use implicit conversion ONLY IF IT SAFE (like ftom "int" to "long"). For any other cases programmer should use explicit conversion (default).

Actually, this simple rule comes from C#: it have explicit conversions by default and ability to explicitly add implicit conversion. And I never had problems with it.

Reply via email to