From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Merrill To: pderbysh@usa.net (Paul Derbyshire) Cc: egcs@cygnus.com Subject: Re: Code gen question Date: Sun, 28 Feb 1999 22:53:00 -0000 Message-ID: References: <3.0.6.32.19990212180551.00841100.cygnus.egcs@pop.netaddress.com> X-SW-Source: 1999-02n/msg00460.html Message-ID: <19990228225300.Y_O6wuUx5KI5MObJZdBT_5tI22jSWiFNXm3WrRWvqUA@z> >>>>> Paul Derbyshire writes: > Which will cause cc1plus to generate better code? > inline int myclass::myfunc (int j) { return j*j*j; } > inline int myclass::myfunc (const int &j) { return j*j*j; } > My guess would be the latter, since the latter when inlined won't make a > copy of the argument passed. Neither will the former. The difference is that the latter refers to its arguments address, which impairs optimization (though not as much as it used to). Absolutely pass scalars by value. Jason