Topic: Defect Report: Unclear wording about capacity of temporary buffers


Author: Kazutoshi Satoda<k_satoda@f2.dion.ne.jp>
Date: Wed, 10 Aug 2011 11:48:26 CST
Raw View
N3290 (2011 FDIS) 20.6.11 [temporary.buffer] paragraph 1, for
get_temporary_buffer()
>  Effects: Obtains a pointer to storage sufficient to store up to n
>  adjacent T objects. ...
I read this as prohibiting to return a buffer of which capacity is less
than n, because such a buffer is not sufficient to store n objects.

The corresponding description in SGI STL is clear on this point, but I
think it is a bit too verbose.
http://www.sgi.com/tech/stl/get_temporary_buffer.html
>  (for the return value, a pair P) ... the buffer pointed to by P.first
>  is large enough to hold P.second objects of type T. P.second is
>  greater than or equal to 0, and less than or equal to len.
Now I propose the following wordings.


Proposed resolution:

Change 20.6.11 [temporary.buffer] paragraph 1 and 2 to

Effects: Obtains a pointer to storage having up to n capacity (in the units of sizeof(T)) to store adjacent T objects. It is implementation defined whether over-aligned types are supported (3.11).

Returns: A pair containing the buffer   s address and capacity, or a pair of 0 values if no storage can be obtained or if n<= 0.
--
k_satoda


[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?= <daniel.kruegler@googlemail.com>
Date: Thu, 11 Aug 2011 08:18:17 CST
Raw View
Am 10.08.2011 19:48, schrieb Kazutoshi Satoda:
>
> N3290 (2011 FDIS) 20.6.11 [temporary.buffer] paragraph 1, for
> get_temporary_buffer()
>>
>> Effects: Obtains a pointer to storage sufficient to store up to n
>> adjacent T objects. ...
>
> I read this as prohibiting to return a buffer of which capacity is less
> than n, because such a buffer is not sufficient to store n objects.
>
> The corresponding description in SGI STL is clear on this point, but I
> think it is a bit too verbose.
> http://www.sgi.com/tech/stl/get_temporary_buffer.html
>>
>> (for the return value, a pair P) ... the buffer pointed to by P.first
>> is large enough to hold P.second objects of type T. P.second is
>> greater than or equal to 0, and less than or equal to len.
>
> Now I propose the following wordings.
>
>
> Proposed resolution:
>
> Change 20.6.11 [temporary.buffer] paragraph 1 and 2 to
>
> Effects: Obtains a pointer to storage having up to n capacity (in the
> units of sizeof(T)) to store adjacent T objects. It is implementation
> defined whether over-aligned types are supported (3.11).
>
> Returns: A pair containing the buffer   s address and capacity, or a pair
> of 0 values if no storage can be obtained or if n<= 0.

If at all this looks more like an editorial problem to me, no real
defect in the wording. I also believe that the suggested form "having
up to n capacity" is bad English.

Greetings from Bremen,

Daniel Kr   gler


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Martin Bonner <martinfrompi@yahoo.co.uk>
Date: Tue, 16 Aug 2011 21:29:36 CST
Raw View
On Aug 10, 6:48 pm, Kazutoshi Satoda<k_sat...@f2.dion.ne.jp> wrote:
> N3290 (2011 FDIS) 20.6.11 [temporary.buffer] paragraph 1, for
> get_temporary_buffer()>  Effects: Obtains a pointer to storage sufficient to store up to n
> >  adjacent T objects. ...
>
> I read this as prohibiting to return a buffer of which capacity is less
> than n, because such a buffer is not sufficient to store n objects.

Correct.  What other reading is possible?

> Now I propose the following wordings.

Sorry, you haven't explained what is wrong with the current wording.

> Proposed resolution:
>
> Change 20.6.11 [temporary.buffer] paragraph 1 and 2 to
>
> Effects: Obtains a pointer to storage having up to n capacity (in the units of sizeof(T))
> to store adjacent T objects. It is implementation defined whether over-aligned types are
> supported (3.11).

As Daniel has said, that is not good English(*).

* - Althought it's almost certainly better than any attempt I might
make at your native language


--
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]