Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!stiatl!srchtec!johnb From: johnb@srchtec.UUCP (John Baldwin) Newsgroups: comp.lang.c++ Subject: Re: Passing by reference (was Re: C++ coding standards) Keywords: standard,variables Message-ID: <176@srchtec.UUCP> Date: 27 Aug 90 12:01:46 GMT References: <183@logo.procase.UUCP> <15361@reed.UUCP> <3233@PEDEV.Columbia.NCR.COM> Organization: search technology, inc. Lines: 36 In article <3233@PEDEV.Columbia.NCR.COM> rogerson@PEDEV.Columbia.NCR.COM (Dale Rogerson) writes: >In article <15361@reed.UUCP> minar@reed.bitnet (Nelson Minar) writes: >>... I find it really nice to know in C that ... The function can't be >>changing the value of that variable ... > >>Is there any sort of nice convention to make this easier to deal with? >If you have well chosen filenames and classnames and provide good header >files this should not be too bad in C++. > [more excerpted] > >The best solution is probably to get a good code browser which would get you >the function prototype at the press of a key. This requires no changes to >the language definition. It might require coding practice changes. >-----Dale Rogerson----- Another practice which may help in debugging/understanding code, especially interrelated code written by different authors, is the aggressive use of the "const" modifier. Not only does it inform the compiler about what your intentions are (as far as what you do/do-not intend to modify), but we've found it's very useful in letting other programmers know what other code can or can't do (without having to wade through all the source code). Another interesting effect (previously noted on this newsgroup) is that once you start using "const," it starts percolating through all your source and header files, as the compiler starts flagging places where something you declared "const" could be changed. Here, we are beginning to find this has beneficial side effects. -- John T. Baldwin | johnb@srchtec.uucp Search Technology, Inc. | johnb%srchtec.uucp@mathcs.emory.edu standard disclaimer: | "... I had an infinite loop, opinions and mistakes purely my own. | but it was only for a little while..."