In .NET I would use System.Diagnostics.Trace...
What would I use in C or C++ ?
right now I have a macro defined:
diagnostics ON:
#define DIAG(A) { printf(A); }
debugging off:
#define DIAG(A) { if(FALSE) {}}
Is there a standard way?
In .NET I would use System.Diagnostics.Trace...
What would I use in C or C++ ?
right now I have a macro defined:
diagnostics ON:
#define DIAG(A) { printf(A); }
debugging off:
#define DIAG(A) { if(FALSE) {}}
Is there a standard way?
It depends on your environment. In Windows, I'd just use OutputDebugString. There's more complicated and configurable ways, but I've never needed it myself.
Not sure if there's a standard on *nix, though. The relatively few times I've written *nix C code, I use a DEBUG
envvar and printf
.