Modernizing IOStreams

From Open Watcom

Revision as of 20:43, 25 April 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

Open Watcom C++ is currently using a "classic" (old style) IOStreams library that is located in name space std. This is somewhat odd. One would normally expect a classic library to be in the global name space and to only find a standard version of IOStreams in name space std. However, the current situation does allow Open Watcom to compile many simple I/O examples according to the standard.

Standard IOStreams differs from the classic library in many respects and advanced users of the library will quickly encounter the differences. Here are two of those differences:

  • Standard IOStreams are template based with separate instantiations for characters and wide characters. Classic IOStreams only support characters using ordinary (non-template) classes.
  • Standard IOStreams use standard locales to control formatting. Classic IOStreams does not have locales.

The purpose of this project is to upgrade Open Watcom's IOStreams library so that it will conform to the standard. The approach we are taking is to, in effect, rewrite the entire library from scratch. In particular, we will build the new library in a temporary name space so that it does not interfer with the existing library while it is under construction. Although the new library will be written "from scratch" we expect (hope) to be able to borrow significant sections of logic, if not actual code, from the existing IOStreams library.

When the new library is ready the name spaces will be renamed to swap the new library into name space std and the old library into the temporary name space. If the result is a major disaster, the libraries can be swapped back if necessary. Otherwise, once the new library has stablized the old library can be, perhaps, eliminated entirely.

The new library will be built from the bottom up. Since standard IOStreams is heavily dependent on locales, the first step will be to provide standard locales for Open Watcom (this can be done directly in name space std since there is no existing locale code to conflict). Once this is done the IOStream class hierarchy can be built, starting with ios_base and working down the inheritance graph toward iostream.

Personal tools