This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libstdc++ [io]fstream cannot open file in binary mode (g++ and egcs)


> I have a feeling may not be correct.  I remember receiving similar
> bug reports and suggestions.  It seemed like an obvious fix - but
> but doing so violated the C++ Standard.  Things may be different
> in this case, but you should make sure.

I checked before I submitted the patch. 27.8.1.9,
[lib.ofstream.cons]/2 says (about the ofstream ctor)

# Effects: Constructs an object of class basic_ofstream<charT,traits>,
# initializing the base class with basic_ostream(& sb) and
# initializing sb with basic_filebuf<charT,traits>()) (27.6.2.2,
# 27.8.1.2), then calls rdbuf()­>open( s, mode|out).311) If that
# function returns a null pointer, calls setstate(failbit), (which may
# throw ios_base::failure).

A similar statement is there for the open method, so I think this
patch is conforming. Please note that a similar change was introduced
to libstdc++ v3 not long ago.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]