home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mole-end!mat
- From: mat@mole-end.matawan.nj.us
- Subject: Re: const on pass by value
- Message-ID: <1992Jul28.180713.16258@mole-end.matawan.nj.us>
- Organization: :
- References: <1992Jul24.151010.11969@PacBell.COM> <9220801.5026@mulga.cs.mu.OZ.AU>
- Date: Tue, 28 Jul 1992 18:07:13 GMT
- Lines: 28
-
- In article <9220801.5026@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
- > mat@uunet.uu.net!mole-end writes:
- >
- > >In article <1992Jul24.151010.11969@PacBell.COM>, pjcondi@lepton (Paul Condie) writes:
- > >> Should pass by value arguments be declared as "const" for
- > >> good coding style? Or is that nit picking?
-
- > >> void foo (const int a);
- > >> or
- > >> void foo (int a);
- > >
- > >It's not nitpicking. It's part of something called const correctness.
- > >Your program has it or doesn't. Programs that have it are almost immune
- > >to a certain large family of errors.
-
- > Huh? In this example, it IS just nitpicking. How could the presence or
- > absence of const in the declaration for foo affect the program's const
- > correctness?
-
- It affects what version of overloads are applied to the variable/object
- and the confidence of the reader that the variables are/are not changed.
-
- Everything that _can_ be const _should_ be const .
- --
- (This man's opinions are his own.)
- From mole-end Mark Terribile
-
- mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
-