Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpwala!cfisun!ima!mirror!necntc!necis!mrst!sdti!turner From: turner@sdti.SDTI.COM (Prescott K. Turner) Newsgroups: comp.lang.c++ Subject: Re: C++ constructor and function semantics Message-ID: <373@sdti.SDTI.COM> Date: 20 Mar 89 22:26:07 GMT References: <1149@oswego.Oswego.EDU> Reply-To: turner@sdti.SDTI.COM (Prescott K. Turner, Jr.) Organization: Software Development Technologies, Sudbury MA Lines: 28 The notion that X var(fun()); should be equivalent to X var = fun(); is a red herring in this discussion -- there are other cases where cfront makes a more blatant distinction between them (as when "fun" returns a type which can be converted to X in 2 steps but not 1). In article <1149@oswego.Oswego.EDU> dl@rocky.oswego.edu (Doug Lea) writes: > (Along these lines, I wonder just how many existing C++ programs will > `break' if/when cfront and g++ make `X var(fun())' operationally > equivalent to `X var = fun()'.) Such a change is not necessary, because the latter syntax will serve. It is not desirable, because it complicates the meaning of initializer: ( expresson-list ) which means Initialize the declared object using the constructor determined by the expression-list as a list of arguments. In most circumstances, I think the elmination of calls to X(X&) is a good thing. To the extent that cfront and g++ handle it, it appears easier to implement than other aspects of C++. As Lea points out, users could benefit a lot from standardizing on this behavior. -- Prescott K. Turner, Jr. Software Development Technologies, Inc. 375 Dutton Rd., Sudbury, MA 01776 USA (508) 443-5779 UUCP: ...{harvard,mit-eddie}!sdti!turner Internet: turner@sdti.sdti.com