79558444

Date: 2025-04-06 16:15:51
Score: 0.5
Natty:
Report link

What you want can be achieved with #ifdef. Since debug mode commonly sets -DDEBUG=1 (or -DDBG=1, you can easily control it either way), you can check for it to determine the mode you are in:

#ifdef DEBUG
static constexpr const char* mode = "debug";
#else
static constexpr const char* mode = "release";
#endif

printf("You are in %s mode\n", mode);

Other config options can be passed as preprocessor flags in the same way.

Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): What you
  • Low reputation (0.5):
Posted by: Dominik Kaszewski