Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2004-08-05 10:09:35


On Thu, Aug 05, 2004 at 08:46:48AM -0600, David Abrahams wrote:

>
> In the constructor documentation, it seems that "Notes" is used to
> document what really are preconditions, e.g.:
>
> "p must be a pointer to an object that was allocated via a C++
> new expression or be 0"
>
> Normally, "notes" are considered to be non-normative in the
> standard. I am trying to update a document on exception safety and
> it would be a big help if all the preconditions appeared in the
> "Requires" clause.

If p is not a pointer to an object allocated with operator new then would
"delete p" not invoke undefined behaviour?

The requirements clause says:

    Requirements: p must be convertible to T *. Y must be a complete type.
    The expression delete p must be well-formed, must not invoke undefined
    behavior, and must not throw exceptions.

So it seems to me that the notes are a non-normative restating of the
requirements. A slightly redundant repetition maybe, but not in the wrong
place.

jon

-- 
"A well-written program is its own heaven
 A poorly written program is its own hell"
	- The Tao of Programming

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk