2

This question is related to the process of porting over an HP-UX executable. On HP-UX, the executable was compiled and linked using the HP-UX ACC Compiler. Given that the compiler was from way back in 1996, it doesn't appear that it supports standard C++ (the standard for C++ that is used today). Rather, it compiles based on a standard for C++ that HP-UX calls classic C++. I was wondering if GCC supported an option for classic C++?

Thanks.

Justin
  • 742
  • 5
  • 17
  • 34
  • 1
    You mean, what portability issues should you expect when taking source from HP-UX to a standards conforming compiler? What compiler-specific snafu's should you expect and can you tackle them? – sehe Jun 12 '12 at 15:42

1 Answers1

5

Haven't found anything like that in the gcc docs, but I might be mistaken.

You can however port from Classic to Standard C++, using the following two guidelines (from the HP documentation):

(1.) IOstream Headers:

<iostream.h> maps to <iostream>

<fstream.h> maps to <fstream> and optionally <iostream>

<strstream.h> maps to <strstream>

<iomanip.h> maps to <iomanip>

Note the new header file <iosfwd> can be used if just the declaration of ostream and istream are needed and not the specific insertion and extraction operators. This would replace the cases where the following are used:

class ostream; // replace by #include <iosfwd>
ostream& operator<<(ostream&, foo); // change based on (2) below

(2.) Source mapping:

Do one (or more) of the following. These changes apply to both the IOstream headers and the container headers. Add the following using directive. This will work for -AA or -AP.

namespace std {} using namespace std;
cout << "hi guy" << endl;

Add specific using declarations. This only works for -AA.

using std::cout;
using std::endl;
cout << "hi guy" << endl;

Add std:: before each symbol. This only works for -AA.

std::cout << "hi guy" << std::endl;
Mario
  • 1,801
  • 3
  • 20
  • 32