- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
class Parent{
int class_id;
union Children{
ClassA classA;
ClassB classB;
.....
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+164
class Parent{
int class_id;
union Children{
ClassA classA;
ClassB classB;
.....
}
}
Найдено на просторах Интернета.
+164
min=(pSamplesVector->operator[](i)).x;
+159
std::ostringstream s;
for( std::list< Candidate* >::iterator it = order_by_priority.begin();
it != order_by_priority.end(); ){
s << (*it)->id << "/" << priorityDesc((*it)->priority());
it++;
if( it!= order_by_priority.end() )
s << ", ";
}
return s.str();
Странное обращение с циклом for.
+159
std::list< Candidate* >::iterator it = order_by_priority.begin();
while( ( speed < (*it)->minspeed ) || ( speed > (*it)->maxspeed ) ){
++it;
if( it == order_by_priority.end() )
break;
}
if( it == order_by_priority.end() )
return NULL;
return *it;
Про for забыли, по 2 раза проверяем...
+146
char odin=1,odin2=1;
if (&odin!=&odin2)
Memo1->Lines->Add("FUCK!");
я новичок, и после 3-й надписи FUCK! в Memo1 мой моск взорвалсо.
помните меня таким, каким я был...
+151
...
else
priv->bDmDisableProtect = fasle;
...
Всё было бы хорошо, не будь это исходники драйверов от Android...
+162
vector<int> vi;
vector<bool> vi_index;
const unsigned unicode_size=0x10FFF;
vi.resize (unicode_size+1);
vi_index.resize (unicode_size+1);
for (int fa=0;fa<vi.size();fa++)
vi[fa]=0;
for (int fa=0;fa<vi.size();fa++)
vi_index[fa]=false;
Человек не умеет инициализировать вектор. Ну, и пр.
+165
static string GetRequestParam(string request)
{
string result="";
int i = 4;
for(char c=request[i];c!=' ';c=request[++i])
result+=c;
return result;
}
+161
String^ TDebug::GetCurrentThreadFunctionName(int CallFunctionIndex)
{
return (gcnew StackTrace(true))->GetFrame(CallFunctionIndex)->GetMethod()->ToString();
};
void TDebug::ShowCurrentFunctionName(void)
{
Windows::Forms::MessageBox::Show(GetCurrentThreadFunctionName(2));
};
Помоему, в Microsoft Visual Studio 2010 отладчик для С++\CLI давно есть. :)
+172
//уничтожение буфера
void delbuf(void* &bf, char ntype)
{
if (ntype=='C')
{
if (bf!=(char*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='B')
{
if (bf!=(BYTE*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='I')
{
if (bf!=(int*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='F')
{
if (bf!=(double*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='D')
{
if (bf!=(double*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='W')
{
if (bf!=(WORD*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='L')
{
if (bf!=(long*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='S')
{
if (bf!=(short*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
if (ntype=='R')
{
if (bf!=(DWORD*) NULL)
{
delete[] bf;
bf=NULL;
}
return;
}
return;
}
86 строк вместо простого delete [] bf