W
William Payne
Hello, I am starting to steer away from the practice of using "using
namespace std;" in my code. Instead I am qualifying each name in the source
when I use them, for example: std::cout << "Hello";
Now to my question. Depending upon the status of my program, I return either
EXIT_SUCCESS or EXIT_FAILURE from main(). Thinking that these constants live
in the std namespace, I tried:
return std::EXIT_FAILURE; but my compiler said:
server.cpp:116: error: parse error before numeric constant
So does that mean that all numeric constants in a namespace are visible
globally? Or are EXIT_FAILURE and EXIT_SUCCESS preprocessor macros
(#defines?) and therefore don't care about namespaces? I am including
<cstdlib>. Anything else I should think of when I want to be careful and
qualify each name where it's used? Any caveats?
/ William Payne
namespace std;" in my code. Instead I am qualifying each name in the source
when I use them, for example: std::cout << "Hello";
Now to my question. Depending upon the status of my program, I return either
EXIT_SUCCESS or EXIT_FAILURE from main(). Thinking that these constants live
in the std namespace, I tried:
return std::EXIT_FAILURE; but my compiler said:
server.cpp:116: error: parse error before numeric constant
So does that mean that all numeric constants in a namespace are visible
globally? Or are EXIT_FAILURE and EXIT_SUCCESS preprocessor macros
(#defines?) and therefore don't care about namespaces? I am including
<cstdlib>. Anything else I should think of when I want to be careful and
qualify each name where it's used? Any caveats?
/ William Payne