Issue 1947: sequence max < length (cxx_revision) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: What happens when you pass a maximum argument that is less than the length argument to the "T* data" constructor of an unbounded sequence? Should the length argument be treated as equal to the max argument, or should an implementation-defined error (such as an assert) be allowed? What happens if you pass a null pointer for the buffer argument to the "T* data" constructor of a sequence? Should the constructor create the sequence as if it was created with the default constructor, or should an implementation-defined error (such as an assert) be allowed? Should a null pointer argument be allowed if the maximum and length arguments are zero? Resolution: Revised Text: Actions taken: September 13, 1998: received issue Discussion: End of Annotations:===== Return-Path: X-Sender: vinoski@mail.boston.iona.ie Date: Sun, 13 Sep 1998 20:12:21 -0400 To: cxx_revision@omg.org, issues@omg.org From: Steve Vinoski Subject: sequence max < length What happens when you pass a maximum argument that is less than the length argument to the "T* data" constructor of an unbounded sequence? Should the length argument be treated as equal to the max argument, or should an implementation-defined error (such as an assert) be allowed? What happens if you pass a null pointer for the buffer argument to the "T* data" constructor of a sequence? Should the constructor create the sequence as if it was created with the default constructor, or should an implementation-defined error (such as an assert) be allowed? Should a null pointer argument be allowed if the maximum and length arguments are zero? --steve Return-Path: X-Authentication-Warning: tigger.dstc.edu.au: michi owned process doing -bs Date: Mon, 14 Sep 1998 10:33:23 +1000 (EST) From: Michi Henning To: Steve Vinoski cc: cxx_revision@omg.org, issues@omg.org Subject: Re: sequence max < length On Sun, 13 Sep 1998, Steve Vinoski wrote: > What happens when you pass a maximum argument that is less than the length > argument to the "T* data" constructor of an unbounded sequence? Should the > length argument be treated as equal to the max argument, or should an > implementation-defined error (such as an assert) be allowed? I'd say it should be implementation-defined. Personally, I would favour an implementation that dumps core immediately in this case because it indicates a programming error. However, I'm not sure we should force this. Silently treating the length argument as equal to the max argument strikes me as not very nice because I don't get any warning that I've done something stupid. But of course, if we say "implementation-defined", that would be a compliant implementation. > What happens if you pass a null pointer for the buffer argument to the "T* > data" constructor of a sequence? Should the constructor create the sequence > as if it was created with the default constructor, or should an > implementation-defined error (such as an assert) be allowed? Again, I would suggest to state that passing null is illegal and results in implementation-defined behavior. > Should a null > pointer argument be allowed if the maximum and length arguments are > zero? I'd prefer to make this illegal as well and say that the behavior is implementation-defined. Michi. PS: We have liberally used the phrase "implementation-defined" above. The problem with this is that, at least according to ANSI C++, this phrase means that the implementation can do anything it likes, but must document what it is it does. On the other hand, "implementation-dependent" means the implementation can do what it likes and doesn't have to document its behavior. I think we should agree on what we want, and then start to make moves towards using consistent and well-defined terminology throughout the C++ mapping. Long-term, I think that could improve the rigor of the spec quite a bit.