Can boolean operators be used with the preprocessor?

#if defined _DEBUG || defined _UNIT_TEST 
  //Code here 
#endif 

You could use AND and NOT operators as well. For instance:

#if !defined _DEBUG && defined _UNIT_TEST 
  //Code here 
#endif 

#if takes any C++ expression of integral type(1) that the compiler manages to evaluate at compile time. So yes, you can use || and &&, as long as you use defined(SOMETHING) to test for definedness.

(1): well, it's a bit more restricted than that; for the nitty-gritty see the restrictions here (at "with these additional restrictions").


#if defined(_DEBUG) || defined(_UNIT_TEST)
  //Code here
#endif

Also for the record, it's #elif, not #elseif.