Re: Const'ness


Subject: Re: Const'ness
From: sam th (sam@uchicago.edu)
Date: Fri Jul 07 2000 - 21:08:12 CDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 8 Jul 2000, Martin Sevior wrote:

> Ah this makes sense. I can't modify the contents of a const pointer. I
> never do anyway since that goes againt spirit protected member variables.
> If something needs changing I always use a setForVariable function.

The other good thing about const pointers is they prevent you from trying
to modify temporaries. If you have the following function

const int foo();

then the compiler won't let you do this:

foo()=6;

whereas if the function did not return const, that statement would be
legal (and a truly horrid idea).
           
                                     sam th
                                     sam@uchicago.edu
                                http://www.abisource.com/~sam/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5Zo0Nt+kM0Mq9M/wRAvfKAJ436//Clr+CJA4XDEi8MIvXLY8fsACfX5SS
upq+UeVEkNHfco6LIZlAEXg=
=TcAu
-----END PGP SIGNATURE-----



This archive was generated by hypermail 2b25 : Fri Jul 07 2000 - 20:05:03 CDT