"I work for a software development house that creates business software, maintaining legacy MFC applications," Graf writes. "We recently received an issue where a filter-toggle wouldn't switch back and forth, never changing from its default value. It's was a small utility function, rarely used, so we were a bit surprised to see it come up. Taking a quick glance at the code revealed the following:
#define ENABLE_FILTER
void CReport::ToggleFilter()
{
#if defined(ENABLE_FILTER)
#undef ENABLE_FILTER
#else
#define ENABLE_FILTER
#endif
}
bool CReport::IsFilterEnabled()
{
#if defined(ENABLE_FILTER)
return true;
#else
return false;
#endif
}