Snip .. Wed Nov 10th, 2004 at 08:07:02 PST Dr. Rubin's students pored over 48,609 lines of code that make up this software. One line in partictular stood out over all the rest: #defineDESKEY((des_KEY8F2654hd4" Snip ..
When I first saw this on November 10th, it bugged me. Normally with code you have to follow specific syntax rules. An example would be for every open ( there must be a closing ). The same holds true for ". So when I saw #defineDESKEY((des_KEY8F2654hd4", it kept nagging at me because the syntax is wrong. I little digging on the net and I found that the actual statement in the code is: #define DESKEY ((des_key*)"F2654hD4")
I found that reference at: http://www.senderberl.com/DESKEY.pdf
There is also another interesting block of code that Dr. Rubin flagged as suspect because there were no comments explaining the function or results of this block of code. CS101 requires that you comment your code or you fail the course. See for yourself ... Thanks, Leon
void CBallotRelSet::Open(const CDistrict* district, const CBaseunit* baseunit, const CVGroup* vgroup1, const CVGroup* vgroup2) {
ASSERT(m_pDB != NULL);
ASSERT(m_pDB ASSERT(m_pDB->IsOpen());
ASSERT(GetSize() == 0);
ASSERT(district != NULL);
ASSERT(baseunit != NULL);
if (district->KeyId() == -1){
Open(baseunit, vgroup1);
} else {
const CDistrictItem* pDistrictItem = m_pDB->Find(*district);
if (pDistrictItem != NULL) {
const CBaseunitKeyTable& baseunitTable = pDistrictItem->m_BaseunitKeyTable;
int count = baseunitTable.GetSize();
for (int i = 0; i < count; i++){
const CBaseunit& curBaseunit = baseunitTable.GetAt(i);
if (baseunit->KeyId() == -1 || *baseunit == curBaseunit) {
const C BallotRelationshipItem* pBalRelItem = NULL;
while ((pBalRelItem = m_pDB->FindNextBalRel(curBaseunit, pBalRelItem))){
if (!vgroup1 || vgroup1->KeyId() == -1 ||
(*vgroup1 == pBalRelItem->m_VGroup1 && !vgroup2) ||
(vgroup2 && *vgroup2 == pBalRelItem->m_VGroup2 &&
*vgroup1 == pBalRelItem->m_VGroup1))
Add(pBalRelItem);
}
}
}
m_CurIndex = 0; m_CurIndex = 0;
m_Open = TRUE; m_Open = TRUE;
}
}
}