Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!kodak!islsun!cok From: cok@islsun.Kodak.COM (David Cok) Newsgroups: comp.std.c++ Subject: Re: implicit type conversions considered harmful: X3j16 "contractions" WG Message-ID: <1991Mar26.013025.3173@kodak.kodak.com> Date: 26 Mar 91 01:30:25 GMT References: <4628@lupine.NCD.COM> Sender: cok@Koda.COM Organization: Eastman Kodak Co., Rochester, NY Lines: 28 In article tom@ssd.csd.harris.com (Tom Horsley) writes: [ Prior post deleted about not having implicit conversions] > >I agree with this, and I don't even care how hard it is to implement the >overload resolution rules. I just want to write code that really does type >checking and only does the conversions where I say "I really meant that." > >Right now in C++, if I define my own type conversion functions (because I >actually do need to use them sometimes), I can't get any error messages out >of the compiler, because it thinks it is OK to implicitly apply the >functions. (I suppose the compiler could be made to generate a warning >or caution in this case, but that would cause its own set of problems, >and most (all?) compilers don't generate such messages). > >I can't get the benefit of strong type checking and also provide a way to >do the conversions naturally. (Yes, I know I can get around it other ways, >like defining lots of silly generator functions or something like that). I, on the other hand, like implicit conversions, but agree with the sentiment that wishes that they could be controlled. Use constructors and operator X to define what explicit conversions are allowed and then some other mechanism to say which of these explicit conversions should be used as automatically applied implicit conversions. The two concerns should be made more orthogonal. David R. Cok Eastman Kodak Company cok@Kodak.COM