[comp.lang.c++] Warning: implicit type conversions make debugging very hard.

shapiro@inria.inria.fr (Marc Shapiro) (07/19/88)

Implicit type conversions are a very nice feature of C++.  However, since
they happen under the covers, they can really mess you up.

We just had the case where we changed the interface to a certain member
function.  By mistake, one of it uses was incorrectly left with the old
interface.  But, the compiler didn't complain, because there is an
obscure conversion operation between the two types.

Admittedly, like all features, type conversion should be handled with
care.  Admittedly, it is a very useful one.  But in some sense it
defeats the purpose of strong type-checking.  Ours is a large project
with many different people, so this kind of error is bound to happen
eventually.

Debugging this kind of case can be very hard.  In this case, since we
are using cfront, a glance at the intermediate ..c file allowed us to
find the problem rather easily.  Native-code compiler writers should
think about this.  There is a need for some kind of debugging traces
for all the wierd things C++ can do under the covers, e.g.
overloading, conversion between objects and references, implicit
arguments, or overloading.

						Marc Shapiro

INRIA, B.P. 105, 78153 Le Chesnay Cedex, France.  Tel.: +33 (1) 39-63-53-25
e-mail: shapiro@inria.inria.fr or: ...!mcvax!inria!shapiro