<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2638: [filesys.ts] [PDTS] Make certain functions noexcept and drop error_code version</title>
<meta property="og:title" content="Issue 2638: [filesys.ts] [PDTS] Make certain functions noexcept and drop error_code version">
<meta property="og:description" content="C++ library issue. Status: NAD">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2638.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#NAD">NAD</a> status.</em></p>
<h3 id="2638"><a href="lwg-closed.html#2638">2638</a>. [filesys.ts] [PDTS] Make certain functions <code>noexcept</code> and drop <code>error_code</code> version</h3>
<p><b>Section:</b> 12.3 [filesys.ts::directory_entry.obs], 15.12 [filesys.ts::fs.op.exists], 15.16 [filesys.ts::fs.op.is_block_file], 15.17 [filesys.ts::fs.op.is_char_file], 15.18 [filesys.ts::fs.op.is_directory], 15.19 [filesys.ts::fs.op.is_empty], 15.20 [filesys.ts::fs.op.is_fifo], 15.21 [filesys.ts::fs.op.is_other], 15.22 [filesys.ts::fs.op.is_regular_file], 15.23 [filesys.ts::fs.op.is_socket], 15.24 [filesys.ts::fs.op.is_symlink], 15.33 [filesys.ts::fs.op.status], 15.35 [filesys.ts::fs.op.symlink_status], 99 [filesys.ts::fs.op.unique_path] <b>Status:</b> <a href="lwg-active.html#NAD">NAD</a>
 <b>Submitter:</b> P.J. Plauger <b>Opened:</b> 2014-01-30 <b>Last modified:</b> 2016-08-12</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all other</b> <a href="lwg-index.html#filesys.ts::directory_entry.obs">issues</a> in [filesys.ts::directory_entry.obs].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#NAD">NAD</a> status.</p>
<p><b>Discussion:</b></p>
<p><b>Addresses: filesys.ts</b></p>
<p>
<code>exists(const path&amp;)</code> should be <code>noexcept</code> (drop <code>error_code</code> version).<br/>
<code>is_*(const path&amp;)</code> should be <code>noexcept</code> (drop <code>error_code</code> version).<br/>
<code>status(const path&amp;)</code> should be <code>noexcept</code> (drop <code>error_code</code> version).<br/>
<code>symlink_status(const path&amp;)</code> should be <code>noexcept</code> (drop <code>error_code</code> version).<br/>
<code>file_status::status()</code> should be <code>noexcept</code> (drop <code>error_code</code> version).<br/>
<code>file_status::symlink_status()</code> should be <code>noexcept</code> (drop <code>error_code</code> version).<br/>
<code>unique_path(const path&amp;)</code> should be <code>noexcept</code> (drop <code>error_code</code> version).
</p>

<p><i>[2014-02-08: Daniel comments]</i></p>

<p>
<code>unique_path(const path&amp;)</code> cannot be declared as <code>noexcept</code>, because it returns an object
during whose construction a memory allocation request may fail, see the rationale provided in <a href="lwg-defects.html#2637" title="[filesys.ts] [PDTS] All functions with error_code arguments should be noexcept (Status: TS)">2637</a><sup><a href="https://cplusplus.github.io/LWG/issue2637" title="Latest snapshot">(i)</a></sup>.
<p/>
<code>exists(const path&amp;)</code> and the <code>is_*(const path&amp;)</code> functions cannot be <code>noexcept</code>, because 
they are specified in terms of <code>status(const path&amp;)</code>, which again may throw an exception, which is explicitly 
described in the Effects (<code>filesystem_error</code>), because the non-throwing function (<code>status(const path&amp;, error_code&amp;)</code>) 
may fail to satisfy the request.
<p/>
<code>symlink_status(const path&amp;)</code> may throw an exception for similar reasons that <code>status(const path&amp;)</code>
could fail.
<p/>
The reference to <code>file_status::status()/symlink_status()</code> looks like a typo to me (there are no such functions
in <code>file_status</code>), presumably <code>directory_entry::status()/symlink_status()</code> was meant. In this case I see 
no reason how these could be marked as <code>noexcept</code>, because these functions all may fail and may throw an exception.
<p/>
Based on this interpretation of the issue discussion I recommend to resolve this issue as NAD.
</p>

<p><i>[Beman Dawes 2014-02-27]</i></p>


  <p/>Issues <a href="lwg-defects.html#2637" title="[filesys.ts] [PDTS] All functions with error_code arguments should be noexcept (Status: TS)">2637</a><sup><a href="https://cplusplus.github.io/LWG/issue2637" title="Latest snapshot">(i)</a></sup>,
  <a href="lwg-closed.html#2638" title="[filesys.ts] [PDTS] Make certain functions noexcept and drop error_code version (Status: NAD)">2638</a><sup><a href="https://cplusplus.github.io/LWG/issue2638" title="Latest snapshot">(i)</a></sup>,
  <a href="lwg-defects.html#2641" title="[filesys.ts] [PDTS] directory_iterator, recursive_directory_iterator, move construct/assign should be noexcept (Status: TS)">2641</a><sup><a href="https://cplusplus.github.io/LWG/issue2641" title="Latest snapshot">(i)</a></sup>,
  and <a href="lwg-defects.html#2649" title="[filesys.ts] [PDTS] path and directory_entry move ctors should not be noexcept (Status: TS)">2649</a><sup><a href="https://cplusplus.github.io/LWG/issue2649" title="Latest snapshot">(i)</a></sup> are concerned with signatures which should or should not
  be <code>noexcept</code>. I will provide unified proposed wording for these issues, possibly in a separate paper.
  
  <p><i>[17 Jun 2014 Rapperswil LWG closes as NAD. Working paper correct as written.]</i></p>

  


<p id="res-2638"><b>Proposed resolution:</b></p>
<p></p>





</body>
</html>
