"You'd think that the C++ Boolean would be a welcome addition to the language," writes Jake E. "Not so much for our outsourcing company. This is what's now in our constants.h file."

#define TRUE 1 #define FALSE 0 ...snip... #define SUCCESS 0 #define FAILURE 1 ...snip... #define SUCCESSFUL 0 #define FAILURE 1 ...snip... #define OPER_SUCCESSFUL "SUCSESS"

"So," Jake continues, "FAILURE and TRUE are the same value, FAILURE gets defined twice, and SUCCESS is misspelled. And what's the use for all these DEFINEs? Why, function return codes of course!"

string Admin::Update() { ...snip... if(!UpdateState()) { RollBackUpd(); RemoveWorkDir(); return ERR_UPD_STATE; } if(CheckInternal()) { return OPER_SUCCESSFUL; } ...snip... return "SUCCESS"; }

"And then there's this usage..."

string returnStr=a.Update(); if(strstr(returnStr.c_str(),"ERROR")) { cout << "\tUpdate: " << returnStr.substr(6, returnStr.length()).c_str() << endl; return; }

"Yes," Jake adds, "it returns a literal char*, which is then cast to an STL string on the function return, which is then cast to a c_str in the comparison, which is finally compared with strstr(). All this for a Boolean! "

"Good thing they only check whether the return string contains 'ERROR' and not any of the various misspellings of SUCCESS. Oh, and as for my attempts at showing the boss how bad our outsourced code is? !SUCSESS. After all, the application did work."