I want to add codes for debug log using some directives.
What is the VB6 equivalent of C-language's #ifdef directives?
Here is the C code and I want to know VB6 directive.
------
#define DEBUGLOG
#ifdef DEBUGLOG
//Do Something
#endif
------
Printable View
I want to add codes for debug log using some directives.
What is the VB6 equivalent of C-language's #ifdef directives?
Here is the C code and I want to know VB6 directive.
------
#define DEBUGLOG
#ifdef DEBUGLOG
//Do Something
#endif
------
VB Code:
#Const Test = True #If Test Then '... #Else '... #End If
I would argue that conditional compilation is great for optional (paid) features that you don't want to include in the shipped executable until someone coughs up the money for them.
Personally, I'd suggest that you should have your debug logging switchable at run-time, not compile-time.
When your customer has one of those really "odd" problems (i.e. one of the the 99.9% of problems; the ones that only happen out there, in The Wild), then shipping them a new executable to install, just to find out what the trouble might be, probably isn't your best option. Having something that they can just "switch on" when required (possibly through a one-time or time-limited passcode) shows them that you are pro-active in sorting out their problems (i.e. you actually thought about all this before shipping the product) and it gets you the diagnostic information that you require more reliably and in a more timely fashion (so you can fix the issue more quickly; another "plus" with customers).
Regards, Phill W.