[diff.cpp03.input.output]

# Annex C (informative) Compatibility [[diff]](./#diff)

## C.6 C++ and ISO C++ 2003 [[diff.cpp03]](diff.cpp03#input.output)

### C.6.16 [[input.output]](input.output "31 Input/output library"): input/output library [diff.cpp03.input.output]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L2684)

**Affected subclauses:** [[istream.sentry]](istream.sentry), [[ostream.sentry]](ostream.sentry), and [[iostate.flags]](iostate.flags)  


**Change:** Specify use of explicit in existing boolean conversion functions[.](#1.sentence-1)

  


**Rationale:** Clarify intentions, avoid workarounds[.](#1.sentence-2)

  


**Effect on original feature:** Valid C++ 2003 code that relies on implicit boolean conversions will fail to
compile with this revision of C++[.](#1.sentence-3)

Such conversions occur in the
following conditions:

- [(1.1)](#1.1)

passing a value to a function that takes an argument of type bool;

- [(1.2)](#1.2)

using operator== to compare to false or true;

- [(1.3)](#1.3)

returning a value from a function with a return type of bool;

- [(1.4)](#1.4)

initializing members of type bool via aggregate initialization;

- [(1.5)](#1.5)

initializing a const bool& which would bind to a temporary object[.](#1.sentence-4)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L2701)

**Affected subclause:** [[ios.failure]](ios.failure)  


**Change:** Change base class of std​::​ios_base​::​failure[.](#2.sentence-1)

  


**Rationale:** More detailed error messages[.](#2.sentence-2)

  


**Effect on original feature:** std​::​ios_base​::​failure is no longer derived directly fromstd​::​exception, but is now derived from std​::​system_error,
which in turn is derived from std​::​runtime_error[.](#2.sentence-3)

Valid C++ 2003 code
that assumes that std​::​ios_base​::​failure is derived directly fromstd​::​exception may execute differently in this revision of C++[.](#2.sentence-4)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L2713)

**Affected subclause:** [[ios.base]](ios.base)  


**Change:** Flag types in std​::​ios_base are now bitmasks with values
defined as constexpr static members[.](#3.sentence-1)

  


**Rationale:** Required for new features[.](#3.sentence-2)

  


**Effect on original feature:** Valid C++ 2003 code that relies on std​::​ios_base flag types being
represented as std​::​bitset or as an integer type may fail to compile
with this revision of C++[.](#3.sentence-3)

[*Example [1](#example-1)*: #include <iostream>int main() {int flag = std::ios_base::hex;
 std::cout.setf(flag); // error: setf does not take argument of type int} â *end example*]
