
On Aug 28, 2012 11:43 AM, "Andrzej Krzemienski" <akrzemi1@gmail.com> wrote:
2012/8/28 Lorenzo Caminiti <lorcaminiti@gmail.com>
" (7)
The documentation lists the following sequence for executing a constructor:
1. Initialize member variables via the constructor member initialization list (if such a list is specified). 2. Check preconditions (but not invariants). 3. Execute constructor body. 4. Check invariants. 5. Check postconditions.
Where do the docs say the above? That's incorrect...
Vicente quotes the thread from this list from two years ago. But the library has been changed since and executes the expected sequence of
checks
(preconditions first, initialization second). I already managed to test that :)
BTW, to simply test contract execution printf-style, you can print in the assertions: precondition( std::clog << ... ) Because the output operator returns a stream that converts to bool true if no error, so a stream can be used in an assertion and to print if you are in a given pre/post/inv. HTH, --Lorenzo