From Jason Turner

[iostream.objects]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpxfempet8/{from.md → to.md} +30 -23
tmp/tmpxfempet8/{from.md → to.md} RENAMED
@@ -1,14 +1,14 @@
1
  ## Standard iostream objects <a id="iostream.objects">[[iostream.objects]]</a>
2
 
3
- ### Overview <a id="iostream.objects.overview">[[iostream.objects.overview]]</a>
4
 
5
  ``` cpp
6
- #include <ios>
7
- #include <streambuf>
8
- #include <istream>
9
- #include <ostream>
10
 
11
  namespace std {
12
  extern istream cin;
13
  extern ostream cout;
14
  extern ostream cerr;
@@ -19,107 +19,114 @@ namespace std {
19
  extern wostream wcerr;
20
  extern wostream wclog;
21
  }
22
  ```
23
 
 
 
 
 
 
24
  The header `<iostream>` declares objects that associate objects with the
25
  standard C streams provided for by the functions declared in
26
  `<cstdio>` ([[c.files]]), and includes all the headers necessary to use
27
  these objects.
28
 
29
  The objects are constructed and the associations are established at some
30
  time prior to or during the first time an object of class
31
  `ios_base::Init` is constructed, and in any case before the body of
32
- `main` begins execution.[^2] The objects are not destroyed during
33
- program execution.[^3] The results of including `<iostream>` in a
34
- translation unit shall be as if `<iostream>` defined an instance of
35
- `ios_base::Init` with static storage duration. Similarly, the entire
36
- program shall behave as if there were at least one instance of
37
- `ios_base::Init` with static storage duration.
38
 
39
  Mixing operations on corresponding wide- and narrow-character streams
40
  follows the same semantics as mixing such operations on `FILE`s, as
41
- specified in Amendment 1 of the ISO C standard.
42
 
43
  Concurrent access to a synchronized ([[ios.members.static]]) standard
44
  iostream object’s formatted and unformatted input ([[istream]]) and
45
  output ([[ostream]]) functions or a standard C stream by multiple
46
- threads shall not result in a data race ([[intro.multithread]]). Users
47
- must still synchronize concurrent use of these objects and streams by
48
- multiple threads if they wish to avoid interleaved characters.
 
 
 
 
49
 
50
  ### Narrow stream objects <a id="narrow.stream.objects">[[narrow.stream.objects]]</a>
51
 
52
  ``` cpp
53
  istream cin;
54
  ```
55
 
56
  The object `cin` controls input from a stream buffer associated with the
57
- object `stdin`, declared in `<cstdio>`.
58
 
59
  After the object `cin` is initialized, `cin.tie()` returns `&cout`. Its
60
  state is otherwise the same as required for
61
  `basic_ios<char>::init` ([[basic.ios.cons]]).
62
 
63
  ``` cpp
64
  ostream cout;
65
  ```
66
 
67
  The object `cout` controls output to a stream buffer associated with the
68
- object `stdout`, declared in `<cstdio>` ([[c.files]]).
69
 
70
  ``` cpp
71
  ostream cerr;
72
  ```
73
 
74
  The object `cerr` controls output to a stream buffer associated with the
75
- object `stderr`, declared in `<cstdio>` ([[c.files]]).
76
 
77
  After the object `cerr` is initialized, `cerr.flags() & unitbuf` is
78
  nonzero and `cerr.tie()` returns `&cout`. Its state is otherwise the
79
  same as required for `basic_ios<char>::init` ([[basic.ios.cons]]).
80
 
81
  ``` cpp
82
  ostream clog;
83
  ```
84
 
85
  The object `clog` controls output to a stream buffer associated with the
86
- object `stderr`, declared in `<cstdio>` ([[c.files]]).
87
 
88
  ### Wide stream objects <a id="wide.stream.objects">[[wide.stream.objects]]</a>
89
 
90
  ``` cpp
91
  wistream wcin;
92
  ```
93
 
94
  The object `wcin` controls input from a stream buffer associated with
95
- the object `stdin`, declared in `<cstdio>`.
96
 
97
  After the object `wcin` is initialized, `wcin.tie()` returns `&wcout`.
98
  Its state is otherwise the same as required for
99
  `basic_ios<wchar_t>::init` ([[basic.ios.cons]]).
100
 
101
  ``` cpp
102
  wostream wcout;
103
  ```
104
 
105
  The object `wcout` controls output to a stream buffer associated with
106
- the object `stdout`, declared in `<cstdio>` ([[c.files]]).
107
 
108
  ``` cpp
109
  wostream wcerr;
110
  ```
111
 
112
  The object `wcerr` controls output to a stream buffer associated with
113
- the object `stderr`, declared in `<cstdio>` ([[c.files]]).
114
 
115
  After the object `wcerr` is initialized, `wcerr.flags() & unitbuf` is
116
  nonzero and `wcerr.tie()` returns `&wcout`. Its state is otherwise the
117
  same as required for `basic_ios<wchar_t>::init` ([[basic.ios.cons]]).
118
 
119
  ``` cpp
120
  wostream wclog;
121
  ```
122
 
123
  The object `wclog` controls output to a stream buffer associated with
124
- the object `stderr`, declared in `<cstdio>` ([[c.files]]).
125
 
 
1
  ## Standard iostream objects <a id="iostream.objects">[[iostream.objects]]</a>
2
 
3
+ ### Header `<iostream>` synopsis <a id="iostream.syn">[[iostream.syn]]</a>
4
 
5
  ``` cpp
6
+ #include <ios> // see [ios.syn]
7
+ #include <streambuf> // see [streambuf.syn]
8
+ #include <istream> // see [istream.syn]
9
+ #include <ostream> // see [ostream.syn]
10
 
11
  namespace std {
12
  extern istream cin;
13
  extern ostream cout;
14
  extern ostream cerr;
 
19
  extern wostream wcerr;
20
  extern wostream wclog;
21
  }
22
  ```
23
 
24
+ ### Overview <a id="iostream.objects.overview">[[iostream.objects.overview]]</a>
25
+
26
+ In this Clause, the type name `FILE` refers to the type `FILE` declared
27
+ in `<cstdio>` ([[cstdio.syn]]).
28
+
29
  The header `<iostream>` declares objects that associate objects with the
30
  standard C streams provided for by the functions declared in
31
  `<cstdio>` ([[c.files]]), and includes all the headers necessary to use
32
  these objects.
33
 
34
  The objects are constructed and the associations are established at some
35
  time prior to or during the first time an object of class
36
  `ios_base::Init` is constructed, and in any case before the body of
37
+ `main` ([[basic.start.main]]) begins execution.[^2] The objects are not
38
+ destroyed during program execution.[^3] The results of including
39
+ `<iostream>` in a translation unit shall be as if `<iostream>` defined
40
+ an instance of `ios_base::Init` with static storage duration.
 
 
41
 
42
  Mixing operations on corresponding wide- and narrow-character streams
43
  follows the same semantics as mixing such operations on `FILE`s, as
44
+ specified in the C standard library.
45
 
46
  Concurrent access to a synchronized ([[ios.members.static]]) standard
47
  iostream object’s formatted and unformatted input ([[istream]]) and
48
  output ([[ostream]]) functions or a standard C stream by multiple
49
+ threads shall not result in a data race ([[intro.multithread]]).
50
+
51
+ [*Note 1*: Users must still synchronize concurrent use of these objects
52
+ and streams by multiple threads if they wish to avoid interleaved
53
+ characters. — *end note*]
54
+
55
+  ISO C 7.21.2.
56
 
57
  ### Narrow stream objects <a id="narrow.stream.objects">[[narrow.stream.objects]]</a>
58
 
59
  ``` cpp
60
  istream cin;
61
  ```
62
 
63
  The object `cin` controls input from a stream buffer associated with the
64
+ object `stdin`, declared in `<cstdio>` ([[cstdio.syn]]).
65
 
66
  After the object `cin` is initialized, `cin.tie()` returns `&cout`. Its
67
  state is otherwise the same as required for
68
  `basic_ios<char>::init` ([[basic.ios.cons]]).
69
 
70
  ``` cpp
71
  ostream cout;
72
  ```
73
 
74
  The object `cout` controls output to a stream buffer associated with the
75
+ object `stdout`, declared in `<cstdio>` ([[cstdio.syn]]).
76
 
77
  ``` cpp
78
  ostream cerr;
79
  ```
80
 
81
  The object `cerr` controls output to a stream buffer associated with the
82
+ object `stderr`, declared in `<cstdio>` ([[cstdio.syn]]).
83
 
84
  After the object `cerr` is initialized, `cerr.flags() & unitbuf` is
85
  nonzero and `cerr.tie()` returns `&cout`. Its state is otherwise the
86
  same as required for `basic_ios<char>::init` ([[basic.ios.cons]]).
87
 
88
  ``` cpp
89
  ostream clog;
90
  ```
91
 
92
  The object `clog` controls output to a stream buffer associated with the
93
+ object `stderr`, declared in `<cstdio>` ([[cstdio.syn]]).
94
 
95
  ### Wide stream objects <a id="wide.stream.objects">[[wide.stream.objects]]</a>
96
 
97
  ``` cpp
98
  wistream wcin;
99
  ```
100
 
101
  The object `wcin` controls input from a stream buffer associated with
102
+ the object `stdin`, declared in `<cstdio>` ([[cstdio.syn]]).
103
 
104
  After the object `wcin` is initialized, `wcin.tie()` returns `&wcout`.
105
  Its state is otherwise the same as required for
106
  `basic_ios<wchar_t>::init` ([[basic.ios.cons]]).
107
 
108
  ``` cpp
109
  wostream wcout;
110
  ```
111
 
112
  The object `wcout` controls output to a stream buffer associated with
113
+ the object `stdout`, declared in `<cstdio>` ([[cstdio.syn]]).
114
 
115
  ``` cpp
116
  wostream wcerr;
117
  ```
118
 
119
  The object `wcerr` controls output to a stream buffer associated with
120
+ the object `stderr`, declared in `<cstdio>` ([[cstdio.syn]]).
121
 
122
  After the object `wcerr` is initialized, `wcerr.flags() & unitbuf` is
123
  nonzero and `wcerr.tie()` returns `&wcout`. Its state is otherwise the
124
  same as required for `basic_ios<wchar_t>::init` ([[basic.ios.cons]]).
125
 
126
  ``` cpp
127
  wostream wclog;
128
  ```
129
 
130
  The object `wclog` controls output to a stream buffer associated with
131
+ the object `stderr`, declared in `<cstdio>` ([[cstdio.syn]]).
132