Boost logo

Boost Users :

Subject: Re: [Boost-users] [Test] Unit test for const suggestion.
From: Richard (legalize+jeeves_at_[hidden])
Date: 2010-09-22 17:10:35


[Please do not mail me a copy of your followup]

boost-users_at_[hidden] spake the secret code
<i7dmr3$e9c$1_at_[hidden]> thusly:

>The compiler stops the compilation with an error if you try to change a
>const variable/type. Still you want to write a unit test that checks
>that the variable cannot be changed. [...]

IMO there is little value to be had by writing such a test, since as
you state above you can't assign to a const quantity and still have
the code compile.

Test the behavior of your classes and leave the const'ness of members
and variables up to the implementor of the class.

-- 
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>
      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net