Re: Are numeric constants in a namespace visible globally?
From: Sharad Kala (no.spam_sharadk_ind_at_yahoo.com)
Date: 02/02/04
- Next message: Rob Williscroft: "Re: Are numeric constants in a namespace visible globally?"
- Previous message: William Payne: "Are numeric constants in a namespace visible globally?"
- In reply to: William Payne: "Are numeric constants in a namespace visible globally?"
- Next in thread: Rob Williscroft: "Re: Are numeric constants in a namespace visible globally?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 2 Feb 2004 17:59:12 +0530
"William Payne" <mikas493_no_s_p_a_m_@student.liu.se> wrote in message
news:bvlela$m59$1@news.island.liu.se...
> 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?
I think they are preprocessor macros, something like
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
-Sharad
- Next message: Rob Williscroft: "Re: Are numeric constants in a namespace visible globally?"
- Previous message: William Payne: "Are numeric constants in a namespace visible globally?"
- In reply to: William Payne: "Are numeric constants in a namespace visible globally?"
- Next in thread: Rob Williscroft: "Re: Are numeric constants in a namespace visible globally?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|