Title
Should is_empty use error_code in its specification?
Status
c++17
Section
[fs.op.is.empty]
Submitter
Jonathan Wakely

Created on 2014-08-01.00:00:00 last changed 89 months ago

Messages

Date: 2016-08-03.20:22:24

Proposed resolution:

  1.     bool is_empty(const path& p);
        bool is_empty(const path& p, error_code& ec) noexcept;
      

    Effects:

    • Determine file_status s, as if by status(p) or status(p, ec), respectively.
    • For the signature with argument ec, return false if an error occurred.
    • Otherwise, if is_directory(s):
      • Create directory_iterator itr, as if by directory_iterator(p) or directory_iterator(p, ec), respectively.
      • For the signature with argument ec, return false if an error occurred.
      • Otherwise, return itr == directory_iterator().
    • Otherwise:
      • Determine uintmax_t sz, as if by file_size(p) or file_size(p, ec), respectively .
      • For the signature with argument ec, return false if an error occurred.
      • Otherwise, return sz == 0.

    Returns: is_directory(s) ? directory_iterator(p) == directory_iterator() : file_size(p) == 0;

    The signature with argument ec returns false if an error occurs.

    Throws: As specified in Error reporting (7).

Date: 2016-08-03.20:22:24

[ 2016-08 Chicago ]

Wed PM: Move to Tentatively Ready

Date: 2016-08-03.20:22:24

[ Apr 2016 Issue updated to address the C++ Working Paper. Previously addressed File System TS ]

Previous resolution [SUPERSEDED]:

  1.     bool is_empty(const path& p);
        bool is_empty(const path& p, error_code& ec) noexcept;
      

    Effects:

    • Determine file_status s, as if by status(p) or status(p, ec), respectively.
    • For the signature with argument ec, return false if an error occurred.
    • Otherwise, if is_directory(s):
      • Create directory_iterator itr, as if by directory_iterator(p) or directory_iterator(p, ec), respectively.
      • For the signature with argument ec, return false if an error occurred.
      • Otherwise, return itr == directory_iterator().
    • Otherwise:
      • Determine uintmax_t sz, as if by file_size(p) or file_size(p, ec), respectively .
      • For the signature with argument ec, return false if an error occurred.
      • Otherwise, return sz == 0.

    Remarks: The temporary objects described in Effects are for exposition only. Implementations are not required to create them.

    Returns: is_directory(s) ? directory_iterator(p) == directory_iterator() : file_size(p) == 0; See Effects.

    The signature with argument ec returns false if an error occurs.

    Throws: As specified in Error reporting (7).

Date: 2016-01-28.01:00:35

[ 9 Oct 2014 Beman supplies proposed wording. ]

Date: 2016-04-10.22:23:37

The descriptions of most functions are explicit about the use of the ec argument, either saying something like "foo(p) or foo(p, ec), respectively" or using the ec argument like foo(p[, ec]), but is_empty does not.

[fs.op.is_empty]/2 refers to ec unconditionally, but more importantly [fs.op.is_empty]/3 doesn't pass ec to the directory_iterator constructor or the file_size function.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-03 20:22:24adminsetmessages: + msg8373
2016-08-03 20:22:24adminsetstatus: new -> ready
2016-04-10 22:23:37adminsetmessages: + msg8045
2016-01-28 01:00:35adminsetmessages: + msg7936
2016-01-28 01:00:35adminsetmessages: + msg7935
2014-08-01 00:00:00admincreate