Re: [Dev-C++] Demystifying namespace
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Maya <Esc...@ne...> - 2003-12-19 11:39:07
|
Thanks!
That's what I call knowing stuff, man!
One last question, in the case below, why is it that I get an error!
namespace jme{
enum error_t{
//Generic error codes
MSG, //Default message
WARNING, //Warning
FATAL, //Display fatal and exit
.....
};
class Someprogram{
std::string* str_example;
public:
Someprogram(){
try{str_example = new std::string;}
catch(std::bad_alloc& x){
// This works!!!!
throw jme::SomeprogramEx(MSG, FILE, METHOD,LINE);
// This doesn't ?????
throw jme::SomeprogramEx(jme::MSG, FILE, METHOD, LINE);
}
}
}; //Someprogram
} // namespace
By the way, Maya is the Sanskrit [ ancient Hindu language ] word for
illusion. It's a hippy thing... I guess. :-\
pw...@ia... wrote:
>1)
>Please. Take as a custom to always use ALL CAPS when #define symbols. It
>is practically impossible to read the code if you don't. Since a #defined
>symbol might be just about any type of expansion it is really important
>when reading the code.
>
>2)
>Since a #defined symbol is a preprocessor construct, they are never - I
>repeat NEVER - inside any namespace. If the compiler have seen the
>#define, and it hasn't been terminated by an #undefine, it will be used.
>The compiler complains, since you try jme::file, jme::line, ... where file
>and line are #defines.
>
>When you write jme::file it represents jme::__FILE__ which is expanded to
>jme::"filename" which isn't a valid construct.
>
>/Per W
>
>On Thu, 18 Dec 2003, Maya wrote:
>
>
>
--
FYI
http://www.astro.umd.edu/~marshall/abbrev.html
E-Mail Policy
http://www.vif.com/users/escalante/Email_Policy.html
* You cannot exercise your power to a point of humiliation.
- Jean Chretien
* The media's the most powerful entity on earth. They have the
power to make the innocent guilty and to make the guilty
innocent, and that's power.
- Malcom X
* "Innocent until proven guilty", no... not in Canada!!
|