Rogue Wave banner
Click on the banner to return to the user guide home page.

Endnotes

1
This example assumes that you have created a class, moneytype, to represent monetary values, and that you have written iostreams insertion << and extraction >> operators for the class. Further, it assumes that these operators format and parse values using the money_put and money_get facets of the locales imbued on the streams they're operating on. See Chapter 5 for a complete example of this technique, using phone numbers rather than monetary values. The moneytype class is not part of the Standard C++ Library.

Return
2
The shift operators for the character types, like char and wchar_t, are an exception to this rule; they are global functions in the standard library namespace ::std.

Return
3
Iostreams does not prevent you from setting other invalid combinations of these flags, however.

Return
4
The standard does not specify whether the grouping information, that is contained in a stream's locale's numpunct facet, is ignored or taken into account if present. In any case, there are no manipulators that allow to switch on and off the grouping.

Return
5
The classification of a character as a white space character depends on the character set used. The extractor takes the information from the locale's ctype facet.

Return
6
The stream buffer can be created as the stream's responsibility, or the buffer can be provided from outside the stream, so inadvertently the buffer could have zero size.

Return
7
The standard does not yet specify whether the inability to allocate memory for the stream's internal data will result in a badbit set or a bad_alloc or ios_base::failure thrown.

Return
8
Actually, the standard does not yet specify how memory allocation errors are to be handled in iostreams. Basically, the two models are:

- A bad_alloc exception is thrown, regardless of whether or not any bits in the exception mask are set.

- The streams layer catches bad_alloc exceptions thrown during allocation of its internal resources, iword and pword. It would then set badbit or failbit. An exception would be thrown only if the respective bit in the exception mask asks for it. It must be specified whether the exception thrown in such a case would be ios_failure or the original bad_alloc.

Moreover, the streams layer must catch all exceptions thrown by the stream buffer layer. It sets badbit and rethrows the original exception if the exception mask permits it.

Return
9
Note that each change of either the stream state or the exception mask can result in an exception thrown. This is because the functions setstate() and exception() raise an exception in case the exception mask requires it.

Return
10
See Bjarne Stroustrup, The C++ Programming Language, 3rd Edition, p.366.

Return
11
The traditional iostreams supported a constructor, taking a file descriptor, that allowed connection of a file stream to an already open file. This is not available in the standard iostreams. However, Rogue Wave's implementation of the standard iostreams provides a corresponding extension (see the Class Reference for file streams).

Return
12
For output file streams the open mode out is equivalent to out|trunc, i.e. you can omit the trunc flag. For bidirectional file streams, however, trunc must always be explicitly specified.

Return
13
Basically the binary mode flag is passed on to the respective operating system's service function, which means that in principle all system-specific conversions will be suppressed, not only the carriage return / linefeed handling.

Return
14
This was different in the old iostreams, where you could have dynamic and static output streams. See Section 24.4 for further details.

Return
15
This, however, is still subject to change. At the time of this writing, a call to the stream's imbue() function modifies both locales.

Return
16
An alternative could be to provide Manip as a static or a global object at the user's convenience. Unfortunately, this approach would introduce the well-known order-of-initialization problems for global and static objects.

Return
17
Traditional iostreams had classes called ostream_withassign that explicitly allowed copying and assignment of stream objects.

Return
18
Traditional iostreams had the copy constructor and assignment operator defined as private member functions; hence, they were not usable. It is an open issue whether the copy constructor and assignment operator of streams should be defined as private member functions.

Return
19
This feature was available in the traditional iostreams, but is not offered by the standard iostreams. Rogue Wave's implementation of the standard iostreams retains the old feature for backward compatibility with the traditional iostreams, but it is a nonstandard feature. Using it might make your application non-portable to other standard iostream libraries.

Return
20
Whether and how the user can influence the setting of the stream buffer's locale is still open. At the time of this writing, a call to the stream's imbue() function changes the stream buffer's locale object as well. In the example above, the shared stream buffer will have the locale object of file2. This is not a problem here because the stream buffer only uses the locale's conversion facet, and both locales will probably have the same void conversion facet. However, this would cause a problem in the case where the streams' locales have different code conversion facets.

Return
21
The traditional iostreams' strstream allows you to obtain a pointer to the stream's internal buffer. Different from the standard iostreams' stringstream, it does not create a copy of the internal data. Hence, using the deprecated strstream instead of the standard stringstream spares you the overhead of creating a second copy of the data.

Return
22
In case of input streams the behavior of sync() is implementation-defined, i.e. is not standardized. The traditional iostreams had a sync() function that did the expected synchronization, i.e. refilling the buffer beginning with the current file position.

Return
23
See functions strftime(), strptime(), and wcsftime() in X/Open for reference.

Return
24
According to the draft working paper, they are two separate arrays. However, RW's implementation uses the old technique involving only one array.

Return
25
Error handling is omitted in the example because the standard does not indicate how pword() and iword() indicate failure. Possible choices would be to throw a bad_alloc exception or to set the failbit.

Return
26
This, of course, is a toy example. You would probably never derive a new class for adding only one data member. However, it keeps the example simple and allows us to demonstrate the principle of deriving new stream classes.

Return
27
For a more detailed discussion of the problem and its solution, see Section 14.2, p. 306ff, of Bjarne Stroustrup, "The Design and Evolution of C++," Addison-Wesley 1994.

Return
28
An introduction to this technique can also be found in Section 6.10, p. 90ff, of Steve Teale's "C++ IOStreams Handbook," Addison-Wesley 1993. Watch out, the example given there has several severe bugs!

Return
29
In our example of a conversion between ASCII and EBCDIC, we have no reason to ever return partial, because this is a conversion of single byte characters. Either a character can be recognized and converted, or the conversion fails; i.e., error will be returned. The partial return code only makes sense in wide-character and multibyte conversions.

Return

©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.


OEM Release, June 1998