P
Petter Reinholdtsen
I ran into a problem on HP-UX 11.00 the other day, where it refused to
compile a program using 'using namespace std;' at the top. The reason
seem to be that the compiler refuses to accept 'using namespace std;'
unless the std namespace was declared first.
This triggered my curiosity, and I tried to find out what the ANSI C++
standard had to say about this. I'm unable to find a conclusion, and
hope someone here have a clue to spare.
Is this code legal ANSI C++, if it is in a file on its own?
using namespace std;
It compiles when using GCC, but now when using "aCC: HP aC++/ANSI C
B3910B A.05.50 [May 15 2003]". The HP-UX compiler protests with "Only
namespace names are valid here."
This code compiles without problems, so I concluded that it was the
lack of a namespace declaration that triggered the bug:
namespace std {};
using namespace std;
Which compiler got this one right? GCC or HP-UX aC++?
compile a program using 'using namespace std;' at the top. The reason
seem to be that the compiler refuses to accept 'using namespace std;'
unless the std namespace was declared first.
This triggered my curiosity, and I tried to find out what the ANSI C++
standard had to say about this. I'm unable to find a conclusion, and
hope someone here have a clue to spare.
Is this code legal ANSI C++, if it is in a file on its own?
using namespace std;
It compiles when using GCC, but now when using "aCC: HP aC++/ANSI C
B3910B A.05.50 [May 15 2003]". The HP-UX compiler protests with "Only
namespace names are valid here."
This code compiles without problems, so I concluded that it was the
lack of a namespace declaration that triggered the bug:
namespace std {};
using namespace std;
Which compiler got this one right? GCC or HP-UX aC++?