Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!decwrl!nsc!voder!procase!roger From: roger@procase.UUCP (Roger H. Scott) Newsgroups: comp.lang.c++ Subject: Re: Passing by reference (was Re: C++ coding standards (Comment needed)) Keywords: standard,variables Message-ID: <187@simscript.procase.UUCP> Date: 26 Aug 90 03:58:11 GMT References: <2161@runxtsa.runx.oz.au> <183@logo.procase.UUCP> <15361@reed.UUCP> Reply-To: roger@procase.UUCP (Roger H. Scott) Organization: proCASE Corporation, Santa Clara, CA Lines: 31 In article <15361@reed.UUCP> minar@reed.bitnet (Nelson Minar) writes: > ... the pass by reference capabilities. > >In C++, this information is not available merely from the function call. >Who knows if > >int a = 0; >foo(a); > >will change the value of a or not in C++, without finding the prototype for >the function and looking carefully. > > >Is there any sort of nice convention to make this easier to deal with? I assume >not. Yes and no. The "convention" I use is to eschew use of "plain" reference arguments and use only "const T&" (reference to *const* object) arguments as a parameter passing efficiency optimization that has no semantic significance. If I want a function to modify a value I'll damn well pass a pointer to the value. @ @ @ @ @ @ @ @ @ @ @