- 1
- 2
- 3
- 4
- 5
- 6
- 7
class boolshit{
public:
boolshit(bool shit):_shit(shit){}
operator bool() const{return _shit;}
private:
bool _shit;
};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+3.3
class boolshit{
public:
boolshit(bool shit):_shit(shit){}
operator bool() const{return _shit;}
private:
bool _shit;
};
:)
+18.2
ProfileManager* man = Application::GetProfileManager();
_DESIRE(man); //гм. "Желать мужика". Ужос какой. Это не я написал, если чо. Это оно само
Вот в коде наткнулся, улыбнуло
+17
unsigned long f( unsigned long a ) {
while( (1 << 24) < a )
a -= (1 << 24);
return a;
}
Найден в дебрях старого проекта. Цель непонятна. Предположение -- обнулить старших 8-мь бит в 32-х битовом числе.
+8
//retrive the weather file
QProcess* process = new QProcess(this);
QString command = "wget -O " + QDir::homePath() + "/.weather.xml http://weather.yahooapis.com/forecastrss?p=" + zip;
if(tempType == "C")
{
command.append("&u=c");
}
process->start(command);
process->waitForFinished();
delete process;
Учитесь писать переносимый код!
+13
__inline BOOL IsNumeric(LPTSTR lpsBuf)
{
int i, nSize = _tcslen(lpsBuf);
for (i = 0; i < nSize; i++)
if ((lpsBuf[i] < _T('0')) || (lpsBuf[i] > _T('9')))
return (FALSE);
return (TRUE);
}
Серъёзный алгоритм.
+17
std::string sError = "";
try
{
fIn = fopen(cszFileName, "rb");
if (fIn == 0)
{
sError = "Can not open file: ";
sError += cszFileName;
throw std::string("");
}
if (!ParseFile(fIn, pLookup))
{
sError = "Bad file format. File: ";
sError += cszFileName;
throw std::string("");
}
sError = "";
throw std::string("");
}
catch (std::string& e)
{
if (fIn != 0)
{
fclose(fIn);
fIn = NULL;
}
if (sError.length() != 0)
{
throw std::exception(sError.c_str());
}
}
Там же нашел еще более шикарное продолжение гавнокода http://govnokod.ru/1459
+18.3
while(0<1)
{
...
}
В универе встречал такой вот бесконечный цикл
+34
void dump_indexes(map<int,stride_slices> picks, ofstream &f);
{
f<<"# full size: "<<picks.size()<<endl;
for(map<int, stride_slices>::iterator
p=picks.begin(); p!=picks.end(); ++p)
{
f<<"## "
<<p->first<<"'st stride slices count: "
<<p->second.size()<<endl;
for(stride_slices::iterator
pp=p->second.begin(); pp!=p->second.end(); ++pp)
{
f<<"### "
<< p->first<<"'st stride, "
<<pp->first<<"'st slice size: "
<<pp->second.size()<<endl;
for(max_slice::iterator
ppp=pp->second.begin(); ppp!=pp->second.end(); ++ppp)
{
f<<"#### "
<<p->first<<"'st stride, "
<<pp->first<<"'st slice, "
<<ppp->first<<"'st chunk size:"
<<ppp->second.size()<<endl;
for(max_chunk::iterator
pppp=ppp->second.begin(); pppp!=ppp->second.end(); ++pppp)
f<<" "
<<p->first<<" "
<<pp->first<<" "
<<ppp->first<<" "
<<pppp->first<<" : "
<<pppp->second<<endl;
}
}
}
}
а как нормально просмотреть кучу вложенных контейнеров?
+33.2
cStaticObject * CreateStaticObject ( obj_id_t object_id, mesh_id_t mesh_id, material_id_t material_id, int32_t coord_x, int32_t coord_y, int32_t coord_z, int32_t angle_azimuth, int32_t angle_zenith, int32_t angle_longitudinal, uint32_t size_x, uint32_t size_y, uint32_t size_z, uint16_t flags );
+46.3
delete ptr + int(ptr=0);
Освобождение памяти и обнуление указателя.