Rediscovering Macros with MC++
I've been coding primarily in C# for a couple of years now. Up until recently it had been almost a year since I coded any real C++ code. Now that I am using MC++ at home I am starting to get back in the habbit and last night I rediscovered macros (you'd be amazed at what you forget to use after a year or so). I've found that they are very useful for repetitive argument validation code. As below
#define EARG_NONNULL(x) \
if ( nullptr == x ) throw gcnew ArgumentNullException(L#x)
I realize that macros can be dangerouns when you abuse them. But people abuse them for a reason ... they're useful.
Some of my friends have told me that Code Snippets in Whidbey are another easy solution to the repetitve nature of coding items like argument validation. I am going to look at those and I'll add a blog entry about them as well in the next few days.
Comments
- Anonymous
March 09, 2005
Just wondering if there are any books coming out on MC++. I am also dabbling with it, but it would be nice to have a book to work with. - Anonymous
March 09, 2005
I don't know of any books yet that cover the Whidbey version of MC++ here are some good links that cover it.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/VS05Cplus.asp
http://msdn.microsoft.com/msdnmag/issues/05/02/PureC/default.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/TransGuide.asp
CodeProject also had some good articles on the subject last time I looked