mark@lznv.ATT.COM (MARK SMITH) (12/29/87)
Here's an interesting consequence of implicit initialization in C++: We intend the following: class A { int i; public: A( int newi ) { i = newi; } }; main() { A abc( 0 ); extern F( &A ); // ... { F( abc ); } } This works fine...but if our program has a bug (in my case, left over from an earlier version) that accidentally renames abc in the inner scope: main() { A abc( 0 ); extern F( &A ); // ... { int abc = 1; F( abc ); } } C++ is happy to convert the int abc into an A for us. Compile typechecking doesn't prevent this type of pilot error. Generally, for each type T there is an associated typechecking type T', decidedly *not* T, defined as a union of types T' = { T, t1, t2, ... } where constructors T( t1 ), T( t2 ), ... have been defined. Mark Smith lznv!mark