Title
Default modes missing from basic_fstream member specifications
Status
cd1
Section
[file.streams]
Submitter
Ben Hutchings

Created on 2004-04-01.00:00:00 last changed 163 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

In [fstream.cons], change

  explicit basic_fstream(const char* s, ios_base::openmode mode); 

to

  explicit basic_fstream(const char* s,
                         ios_base::openmode mode = ios_base::in|ios_base::out);

In [fstream.members], change

  void open(const char*s, ios_base::openmode mode); 

to

  void open(const char*s,
            ios_base::openmode mode = ios_base::in|ios_base::out);
Date: 2004-04-01.00:00:00

The second parameters of the non-default constructor and of the open member function for basic_fstream, named "mode", are optional according to the class declaration in 27.8.1.11 [lib.fstream]. The specifications of these members in 27.8.1.12 [lib.fstream.cons] and 27.8.1.13 lib.fstream.members] disagree with this, though the constructor declaration has the "explicit" function-specifier implying that it is intended to be callable with one argument.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2716
2004-04-01 00:00:00admincreate