Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-921

Use preprocessor directives for using the best choice of iostreams

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.3.0
    • 2.4.0
    • Miscellaneous
    • None
    • Operating System: Windows NT/2K
      Platform: PC
    • 20643

    Description

      In StdOutFormatTarget.cpp old-style iostreams (#include <iostream.h>) are used to support non-ANSI C++ compliant compilers (cf. Rev 1.4 note). Wouldn't it be better to use preprocessor directives instead?

      Not only does VC++ 7.x emit a warning when old-style iostreams are used, but you also end up with a dependency on the run-time library MSVCI70.DLL that you wouldn't need otherwise. The ANSI compliant iostreams are implemented in MSVCP70.DLL, and you don't always want to ship both DLLs when distributing an application that is otherwise only using the latter DLL.

      This works with VC++ 7.x, but tests for more ANSI C++ compliant compilers should of course be added.

      #if (_MSC_VER >= 1300) // Perhaps use 1200 instead; VC6 supports ANSI C++ compliant iostreams, doesn't it?
      // Use ANSI C++ compliant iostreams
      #include <iostream>
      using namespace std;
      #else
      // Use old-style iostreams
      #include <iostream.h>
      #endif

      Attachments

        Activity

          People

            Unassigned Unassigned
            carbe771@student.liu.se C-J Berg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: