Link to home
Start Free TrialLog in
Avatar of Mike737
Mike737

asked on

Conditional Compilation

I was wondering if there was an equivalent way to do this C++ code in VB.

#if _DEBUG
      #define RunMethod(x) RunMethodA(x)
#else
      #define RunMethod(x) x
#endif

The main reason I wish to do this is I will be writing a testing suite and I will be writing these functions into if statements
eg. if TestCondition(3>4) then
So when I compile it in Debug it will call TestCondition, but when it is compiled to Release mode it change to "if 3>4 then". The other reason I really need it done like this instead of just returning straight away from inside the TestCondition function if compiled in release mode is that the file which will contain the function shall be removed from the source before the Release version is compiled

Avatar of drichards
drichards

Avatar of Mike737

ASKER

Still doesn't solve my issue.
I need the #define specifically.

If I was to do it just as a #if,#else everytime for every if statment I write the extra number of lines I would have to write would be rediculous! I would be looking at an extra 300 lines in my code if I had 100 if statements in it.

I don't really think that just #if's by themselves are an acceptable soloution.

ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike737

ASKER

Looks like you are on the right track with that one.
Been able to get a nice little testing interface up and working with that one.

Absolutely awesome answer dude!