"While digging through some inherited code," writes Joe "M2tM" Smith, "I encountered a conditional masquerading as a loop."
"Thankfully, the fellow responsible is 'no longer with us', and I suppose this type of code stands as silent testament to why. This interesting loop is only created so the break keyword can be used as an elaborate GOTO."
bool bCreateModel = false; for (;;) { if (!pModel) { bCreateModel = true; break; } if (asModelParts.GetSize() != asModelPartsToLoad.GetSize()) { bCreateModel = true; break; } for (UINT32 i = 0; i < asModelPartsToLoad.GetSize(); ++i) { if (asModelPartsToLoad[i] != asModelParts[i]) { bCreateModel = true; break; } } break; }
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!