Preprocessor directives

Reply

Join Date: Apr 2004
Posts: 45
Reputation: BlackDice is an unknown quantity at this point 
Solved Threads: 0
BlackDice's Avatar
BlackDice BlackDice is offline Offline
Light Poster

Preprocessor directives

 
0
  #1
Apr 29th, 2004
Is there a way in VB to use a '#define' macro something like in c++? In C++ I can do this:

#define CHECKPTR if(!ptr) AfxMessageBox("Pointer is null");

then everywhere I wanted to do that check, (of course the pointer would always have to be named 'ptr'), I could just write this:

ptr = new CSomePointer;
CHECKPTR

the preprocessor actually expands the text in the appropriate places before compiling the code, so I don't have to have that same code everywhere. Is there a way to do this in VB?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC