From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bill Currie To: "E. Robert Tisdale" Cc: egcs@egcs.cygnus.com Subject: Re: Named Return Value Extension Proposal Date: Wed, 31 Mar 1999 23:46:00 -0000 Message-ID: <36F72380.D8230871@tssc.co.nz> References: <199903230337.TAA18800@kankakee.wrs.com> <36F712BA.C6A41522@netwood.net> X-SW-Source: 1999-03n/msg00744.html Message-ID: <19990331234600.aGZhJfua62_uCzScT8UH0o7vwsjhfaZILbpqLDKalKo@z> E. Robert Tisdale wrote: > Not quite. The function prototype is X g0(X); > which means that the compiler creates a temporary > for argument X when X g0(X) is called > then the copy constructor is called to initialize > the return value for g0(X) before entering > the body of the function. Uh huh, and just why are you declaring your function as X g0(X) anyway? You would be much better off declaring it as X g0(const X&), which will prevent the creation of a temporary (this is exacty what const& was designed for, AIUI). const & is your (and the compiler's) friend. Bill -- Leave others their otherness