Talk About Network

Google





Programming > C - C++ Learning > throw msg macro
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 4124 of 4400
Post > Topic >>

throw msg macro

by bpatton <bpatton@[EMAIL PROTECTED] > Apr 20, 2008 at 12:46 PM

I'm trying to define a macro to be able to pass to throw a character
constant and some other values

Here's what I'm defining

#ifndef CR
#define CR << "\n"
#endif
#ifndef FL
#define FL  << " (" << __FILE__ << ':' << __LINE__ << ")"
#endif
#ifndef SP
#define SP << ' '
#endif
#ifndef MSG
#define MSG(m) string str(m)
#endif

Here's where I'm trying to use it:

	if (file.empty()) throw(MSG("Empty string recieved!") FL CR);


I'm using MSVisual Express 2008
I need for the first element of of the macro to be a constant char as
input to a string
Then have the << from FL and CR to add teh file name and line number
to the string then this will be caught by my catch section.
 




 6 Posts in Topic:
throw msg macro
bpatton <bpatton@[EMAI  2008-04-20 12:46:06 
Re: throw msg macro
Ian Collins <ian-news@  2008-04-21 09:54:39 
Re: throw msg macro
bpatton <bpatton@[EMAI  2008-04-20 16:17:00 
Re: throw msg macro
Ian Collins <ian-news@  2008-04-21 11:25:43 
Re: throw msg macro
bpatton <bpatton@[EMAI  2008-04-21 04:34:00 
Re: throw msg macro
Ulrich Eckhardt <dooms  2008-04-21 18:19:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 13:49:38 PST 2009.