Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c++ > #286

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

From Kazutoshi Satoda<k_satoda@f2.dion.ne.jp>
Newsgroups comp.std.c++
Subject Re: Defect Report: Unclear wording about capacity of temporary buffers
Date 2011-09-11 09:12 -0700
Organization unknown
Message-ID <4E6B83BB.8000307@f2.dion.ne.jp> (permalink)
References <4E58F6CA.5080306@f2.dion.ne.jp>

Show all headers | View raw


Daniel Krügler wrote:
>  Could you
>  please provide a more elaborate description how the current wording
>  state could be misinterpreted? If there exist a real-world example of
>  this misinterpretation, this would be even better.

There seems to be two different targets of the "up to n" modification:
The capacity of obtained buffer, and the actual number that the caller
will store into the buffer.

First I read as the latter, and got surprised seeing that libstdc++
implementation can return a smaller buffer. I started searching about
get_temporary_buffer(). After reading a quote from TC++PL at
stackoverflow, I realized that the former is intended.
http://stackoverflow.com/questions/3264299/why-do-i-need-stdget-temporary-buffer

Such misinterpretation seems common:
   - The above question is likely started from same misinterpretation.
   - JIS standard (Japanese translation of ISO/IEC standard) says nothing
     like "up to". I think the editor misinterpreted the original wording,
     and omitted words for "up to" as it is redundant. (If a buffer is
     sufficient to store n objects, it is also sufficient to store
     up to n objects.)
   - Rogue Wave implementation doesn't return smaller buffer, instead, it
     can return larger buffer on some circumstances.
     Apache STDCXX http://stdcxx.apache.org/ is a derived version of that
     implementation, and publicly accessible.
     http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_rawiter.h?view=markup&pathrev=1162883#l123
     http://svn.apache.org/viewvc/stdcxx/trunk/src/tmpbuf.cpp?view=markup&pathrev=1162883#l55
     http://stdcxx.apache.org/doc/stdlibref/get-temporary-buffer.html
     >  Specializations of the get_temporary_buffer() function template
     >  attempt to allocate a region of storage sufficiently large to store at
     >  least n adjacent objects of type T.
     I know one commercial compiler package based on Rogue Wave
     implementation, and its implementation is essentially same as the
     above.

>  It
>  is true, that the reader must somehow understand that the "capacity"
>  mentioned in p2 must refer to the more indirect requirement expressed by
>  "storage sufficient to store up to n adjacent T objects".

How a reader can understand such relation on the original wording? I
think some external information (like the quote from TC++PL) is required
to conclude as such.

-- 
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                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Defect Report: Unclear wording about capacity of temporary buffers Kazutoshi Satoda <k_satoda@f2.dion.ne.jp> - 2011-08-28 08:41 -0700
  Re: Defect Report: Unclear wording about capacity of temporary buffers Daniel Krügler<daniel.kruegler@googlemail.com> - 2011-08-28 11:07 -0700
  Re: Defect Report: Unclear wording about capacity of temporary buffers Kazutoshi Satoda<k_satoda@f2.dion.ne.jp> - 2011-09-11 09:12 -0700
    Re: Defect Report: Unclear wording about capacity of temporary buffers Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-09-11 17:47 -0700

csiph-web