Title
[filesys.ts] [PDTS] All functions with error_code arguments should be noexcept
Status
open
Section
[fs.op.canonical] [fs.op.current_path] [fs.op.read_symlink] [fs.op.system_complete] [fs.op.temp_dir_path] [fs.op.unique_path] [path.member]
Submitter
P.J. Plauger

Created on 2014-01-30.00:00:00 last changed 90 months ago

Messages

Date: 2016-01-28.01:00:35

Proposed resolution:

Change 14 Class recursive_directory_iterator [class.rec.dir.itr]:

recursive_directory_iterator& increment(error_code& ec) noexcept;

Change 14.1 recursive_directory_iterator members [rec.dir.itr.members]:

recursive_directory_iterator& increment(error_code& ec) noexcept;
Date: 2016-01-28.01:00:35

[ 21 May 2014 Beman Dawes reviewed all functions with error_code& arguments, and provided proposed wording for the one case found where the above guidelines were not met. This was the case previously identified by Stephan T. Lavavej. ]

Date: 2016-01-28.01:00:35

[ Beman Dawes 2014-02-27 ]

Issues 2637, 2638, 2641, and 2649 are concerned with signatures which should or should not be noexcept. I will provide unified proposed wording for these issues, possibly in a separate paper.

Date: 2014-02-08.00:00:00

[ 2014-02-08: Daniel comments ]

All functions that return a path value such as canonical, current_path, read_symlink, system_complete, temp_directory_path, unique_path, or any member function returning a path value or basic_string value might legally throw an exception, if the allocator of the underlying string complains about insufficient memory. This is an anti-pattern for noexcept, because the exception-specification includes the return statement of a function and given the fact that the language currently does declare RVO as an optional action, we cannot rely on it.

The Standard is currently very careful not to specify functions as noexcept, if this case can happen, see e.g. std::locale::name(). To the contrary, enforcing them to be noexcept, would cause a similar problem as the unconditional noexcept specifier of the value-returning kill_dependency as denoted by LWG 2236.

Basically this requirement conflicts with the section "Adopted Guidelines", second bullet of N3279.

Date: 2016-01-31.20:31:05

Addresses: filesys.ts

all functions with error_code arguments should be noexcept (see canonical, current_path, read_symlink, system_complete, temp_directory_path, unique_path, plus member functions).

[2014-02-03: Stephan T. Lavavej comments:]

The declaration and definition of "recursive_directory_iterator& increment(error_code& ec);" should almost certainly be marked noexcept.

History
Date User Action Args
2017-07-30 20:10:41adminsetstatus: wp -> open
2016-01-28 01:00:35adminsetmessages: + msg7823
2016-01-28 01:00:35adminsetmessages: + msg7822
2016-01-28 01:00:35adminsetmessages: + msg7821
2016-01-28 01:00:35adminsetmessages: + msg7820
2014-01-30 00:00:00admincreate