Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!netnews.upenn.edu!eniac.seas.upenn.edu!atteson From: atteson@eniac.seas.upenn.edu (Kevin Atteson ) Newsgroups: comp.lang.c++ Subject: anomaly with g++; named return values Message-ID: <41839@netnews.upenn.edu> Date: 23 Apr 91 22:11:07 GMT Sender: news@netnews.upenn.edu Reply-To: atteson@eniac.seas.upenn.edu (Kevin Atteson ) Distribution: usa Organization: University of Pennsylvania Lines: 15 Nntp-Posting-Host: eniac.seas.upenn.edu I have the following two unrelated questions. I think responses are best sent to me. 1. Consider a class X which has conversions both to and from another class Y. When I do "return x" with x of class X and the return type of class X, the compiler causes x to be converted to Y and then back. I'm using g++ version 1.34. Is this what C++ is supposed to do? Perhaps I'm using classes and conversions in a way that they aren't meant to be used. 2. Is it possible to name the return variable so that one doesn't have to create a dummy variable of that type? If not, I suppose its only a minor nuissance. Kevin Atteson