
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. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

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

Jonathan Wakely <cow@compsoc.man.ac.uk> writes:
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.
Right; I realized that just after posting :( The "Exception Safety" clause should be moved into the "Effects" section, though. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

David Abrahams <dave@boost-consulting.com> writes:
The "Exception Safety" clause should be moved into the "Effects" section, though.
Also, there should be a comma after "bad_alloc", otherwise it reads as though (bad_alloc or an implementation-defined exception) will be thrown if a resource other than memory is exhausted. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
participants (2)
-
David Abrahams
-
Jonathan Wakely