
on Mon Jul 18 2011, Vicente Botet <vicente.botet-AT-wanadoo.fr> wrote:
Hi Lorenzo,
I don't remember what N1962 says, but I would force that preconditions and post conditions evaluation shall not throw. If an exception is throw during precondition evaluation, post-condition preparation or evaluation I would say the program should terminate, as the program can not state if the conditions are satisfied or not.
That doesn't make any sense to me. If you run out of memory while evaluating a precondition, it means you can't evaluate the precondition, not that the program can't recover. My guidelines are: - Use exceptions for recoverable conditions. - Do not use exceptions for non-recoverable conditions - Failure to satisfy a precondition is a program bug - Program bugs are non-recoverable - Anticipated failure to satisfy a postcondition (e.g. I can't get enough memory to do my job) is a recoverable condition - An actual postcondition violations is a program bug. HTH, -- Dave Abrahams BoostPro Computing http://www.boostpro.com