Bad Programming Practices 101
Jul. 27th, 2004 04:08 pmThe next person who casts away constness on an object that I'm deliberately returning as a const object because I don't want them modifying it except through the specific functions that I've provided to do so is going to get thrashed about the head and shoulders.
no subject
Date: 2004-07-27 09:49 pm (UTC)#include Deviousness.h
#include MessedUpValues.h
void ScrewUpBillsCode()
{
const BillsObjectType* billsObject = BillsFunction();
BillsObjectType* screwedObject = const_cast<BillsObjectType*>(billsObject);
screwedObject->member = k_CRAP;
// mwahaha
}
no subject
Date: 2004-07-27 10:11 pm (UTC)no subject
Date: 2004-07-28 11:44 am (UTC)Ya, I know, not nearly as satisfying as the "thrashing" thing. :-)
no subject
Date: 2004-07-28 02:18 pm (UTC)