For the most part, the Message Queue Processor at Andy's company is not a terrible application to work with. Most changes – such as setting up a new queue, changing trigger times, and so forth – can be done by changing configuration files. At least, that was Andy's opinion before having to make a change to its code…

Andy needed to add in support for serializing on multiple recipients, which mostly meant that he’d have to throw together an overload for the Serialize method. Not a big deal, until he made the fatal mistake of declaring a variable named cOut:

void Serialize(ostream& cOut, vector<CRcpt>& rRcpt) {  ...  }

All of a sudden, this caused over fifty errors. An hour later, Andy was able to locate the following code:

// This is neccessary so we don't have errors in the code
#define COUT cout
#define COUt cout
#define COuT cout
#define COut cout
#define CoUT cout
#define CoUt cout
#define CouT cout
#define Cout cout
#define cOUT cout
#define cOUt cout
#define cOuT cout
#define cOut cout
#define coUT cout
#define coUt cout
#define couT cout
#define ucout cout
#define ucot cout
... snip ...

The single comment didn’t elaborate on why they received the errors, but it was pretty obvious: to help with the potpourri of “cout” typos throughout the code.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!