Yes, I think this is a bad programming practice.
Using implicit conversions can lead to very strange errors. I once had the following problem. It all started with this function:
void doSomething (ClassX x, ClassY y, bool b);
This function is called with code like this:
ClassX x; ClassY y; doSomething (x, y, true);
Someone later decided that the arguments to doSomething should be changed, since doSomething now also required an instance of ClassZ. In addition, in many cases the boolean argument was true, so it was changed to the default argument, for example:
void doSomething (ClassX x, ClassY y, ClassZ z, bool b=true);
Although most of the code was changed, the call shown earlier was not changed. Oddly enough, ClassZ had an implicit constructor that takes bool as an argument:
class ClassZ { public: ClassZ(bool b); };
The following happened. This call:
ClassX x; ClassY y; doSomething (x, y, true);
Suddenly transformed into a compiler:
ClassX x; ClassY y; doSomething (x, y, ClassZ(true), true);
With the 4th argument being the default.
Over the years, we found out that something did not work correctly, and after a lot of debugging, we found out that the reason for this was the reason for this call.
In this way:
- never rely on implicit conversions
- label constructors with 1 argument as explicit
- try to avoid using default arguments