<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3027: [networking.ts] DynamicBuffer prepare exception specification</title>
<meta property="og:title" content="Issue 3027: [networking.ts] DynamicBuffer prepare exception specification">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3027.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="3027"><a href="lwg-active.html#3027">3027</a>. [networking.ts] <code>DynamicBuffer</code> <code>prepare</code> exception specification</h3>
<p><b>Section:</b> 16.2.4 [networking.ts::buffer.reqmts.dynamicbuffer] <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Vinnie Falco <b>Opened:</b> 2017-10-16 <b>Last modified:</b> 2020-09-06</p>
<p><b>Priority: </b>3
</p>
<p><b>View other</b> <a href="lwg-index-open.html#networking.ts::buffer.reqmts.dynamicbuffer">active issues</a> in [networking.ts::buffer.reqmts.dynamicbuffer].</p>
<p><b>View all other</b> <a href="lwg-index.html#networking.ts::buffer.reqmts.dynamicbuffer">issues</a> in [networking.ts::buffer.reqmts.dynamicbuffer].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p><b>Addresses: networking.ts</b></p>
<p>
The current wording for the <code>DynamicBuffer</code> <code>prepare</code>
member function implies that <code>std::length_error</code> is the
only allowable thrown exception. This should be changed to reflect that
any exception may be thrown, with <code>std::length_error</code> thrown
in particular when <code>size() + n</code> exceeds <code>max_size()</code>.
</p>

<p><i>[2017-11-08]</i></p>

<p>Priority set to 3 after five votes on mailing list</p>


<p id="res-3027"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4588">N4588</a>.</p>

<ol>
<li><p>Change 16.2.4 [networking.ts::buffer.reqmts.dynamicbuffer], Table 14 "DynamicBuffer requirements", as indicated:</p>

<blockquote>
<table border="1">
<caption>Table 14 &mdash; <code>DynamicBuffer</code> requirements</caption>
<tr>
<th>expression</th>
<th>return type</th>
<th>assertion/note pre/post-condition</th>
</tr>
<tr>
<td colspan="3" align="center">
<code>[&hellip;]</code>
</td>
</tr>
<tr>
<td>
<code>x.prepare(n)</code>
</td>
<td>
<code>X::mutable_buffers_type</code>
</td>
<td>
Returns a mutable buffer sequence <code>u</code><br/>
representing the writable bytes, and where<br/>
<code>buffer_size(u) == n</code> . The dynamic buffer<br/>
reallocates memory as required. All constant or<br/> 
mutable buffer sequences previously obtained using<br/>
<code>data()</code> or <code>prepare()</code> are invalidated.<br/>
<i>Throws:</i> <code>length_error</code> if <code>size() + n</code><br/>
exceeds <code>max_size()</code> <ins>or any other exception<br/> 
if the request cannot otherwise be satisfied</ins>.
</td>
</tr>
</table>
</blockquote>
</li>
</ol>





</body>
</html>
