|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-06-27 08:26:07
"Peter Dimov" <pdimov_at_[hidden]> writes:
> David Abrahams wrote:
>> "Peter Dimov" <pdimov_at_[hidden]> writes:
>>
>>> I think that the default behavior on a sequence of two saves with
>>> the same address should be to write the two objects, as if address
>>> tracking isn't on. If later a pointer to that address is saved, an
>>> exception should occur. Or more generally,
>>>
>>> - one value save, then N pointer saves sharing the same address
>>> should be OK;
>>>
>>> - M pointer saves sharing the same address should be OK; (*)
>>>
>>> - K value saves sharing the same address should be OK and result in
>>> K copies in the archive;
>>>
>>> - all other sequences raise an exception at first opportunity.
>>
>> I'm sure you mean trigger an assertion, right? ;-)
>
> No, I really mean an exception. Asserting while saving isn't a good thing;
> the program goes down, taking the user's document with it. Saving into a
> different format may be successful and the opportunity shouldn't be denied.
An assertion can always be set up to throw in release mode. I was
thinking of BOOST_ASSERT or something like it, not plain old assert.
> A release build with assertions disabled that silently produces unreadable
> files isn't a good thing, either.
But don't you want to be able to debug this coding error when you make
it during development?
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk