- 1
- 2
- 3
- 4
bool SCG__PROCEDURE_DestroyThreadAfterFinalizeExecutedTaskForThisThreadAndFreeMemoryAllocatedForThreadsStructuresIfNeed(TThread* ThreadForDestroy)
{
...
};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+75.7
bool SCG__PROCEDURE_DestroyThreadAfterFinalizeExecutedTaskForThisThreadAndFreeMemoryAllocatedForThreadsStructuresIfNeed(TThread* ThreadForDestroy)
{
...
};
Из проэкта моего знакомого. Комментарии он пишет очень редко.
+103.9
la:
for j:=8 to (length(a)-length(b) div 2) do
begin
...
if(a[j]>'5') goto la;
...
if(a[j]>'7') goto la;
...
if(a[j]>'2') goto la;
...
j:=j-8;
...
form1.memo1.text=form1.memo1.text+'; '+inttostr(j)+'5';
...
if(a[j]>'1') goto g;
...
j:=j+8;
end;
g:
Не знаю почему, но меня охватывают фиерические чувства. Найденно на просторах рунета в разделах готовых решений задач для студентов.
+57.4
volatile void* AllocatedMemory;
int AllocateMemoryThread(const int size)
{
char buffer[size];
AllocatedMemory=(void*)buffer;
AllocatingDone.Signal();
Sleep(INFINITY);
return 0;
};
...
void* MAlloc(const int size)
{
CriticalSection.Lock();
if( !CreateThread(AllocateMemoryThread,true,size,0) )
return NULL;
AllocatingDone.Wait();
const void* AllocatedBuffer=AllocatedMemory;
CriticalSection.UnLock();
return AllocatedBuffer;
};
CriticalSection - критическая секция.
AllocatingDone - какой-то семафор.
Вообще не могу понять код. Что он этим хотел сказать...
−128.3
Select Case Microsoft.VisualBasic.Right(FileLBL.Text.Trim, 3)
Case "pdf"
IconIMG.ImageUrl = "~/img/pdf.bmp"
Case "doc"
IconIMG.ImageUrl = "~/img/word.bmp"
Case "xls", "csv"
IconIMG.ImageUrl = "~/img/excel.bmp"
Case "rpt"
IconIMG.ImageUrl = "~/img/crystal.bmp"
Case "txt"
IconIMG.ImageUrl = "~/img/text.bmp"
Case Else
IconIMG.ImageUrl = "~/img/blank.bmp"
End Select
+71.1
if (getHook() != null ? !getHook().equals(pmCounty.getHook()) : pmCounty.getHook() != null) return false;
Код западной enterprise системы для риэлторов. Написан русскими.
+58.4
// кусок из хидера
#define b__bl {
#define e__bl }
#define b__st {
#define e__st }
#define b__un {
#define e__un }
...
#define end_if else ;
// Один коротенький метод
void Sud::vosstkdr()
b__fu int i=0, imv=0, imasOut=0, lpovt;
for(; i<isl; i++) b__fo
if(imv < lmv)
if(i==(Pmvosst=mvosst+imv)->imkdrish)
{ lpovt=Pmvosst->nvosst+1; imv++;}
else lpovt=1;
else lpovt=1;
for(int k=0; k<lpovt; k++) b__fo
masOut[imasOut] = mkdrish[i];
if(mdm) if(++imasOut == 35) return; end_if
else if(++imasOut == 32) return; end_if
e__fo
e__fo
e__fu
Вот так у нас пишет один матёрый программист (юникс). Привёл для примера коротенький метод.
Особое внимание заслуживает идентификатор mkdrish. Это какая-то комбинация слов "массив", "кадр", "short"
+132.9
if ("Recap".Equals(Request["post_back"]))
{
<...>
if (Request["apply_coupon.x"] != null)
{
ValidateCoupon();
}
else if ("Recap".Equals(Request["post_back"]))
{ <...> }
<...>
}
Из одного очень древнего проекта, с самопальным post back'ом
+152.9
if(empty($result) || false === $result) {
//
}
Написано человеком с 9ти летним опытом... Что б точно не прошло...
+136
public bool IsPositiveNumber(String strNumber)
{
Regex objNotPositivePattern = new Regex("[^0-9.]");
Regex objPositivePattern = new Regex("^[.][0-9]+$|[0-9]*[.]*[0-9]+$");
Regex objTwoDotPattern = new Regex("[0-9]*[.][0-9]*[.][0-9]*");
return !objNotPositivePattern.IsMatch(strNumber) &&
objPositivePattern.IsMatch(strNumber) &&
!objTwoDotPattern.IsMatch(strNumber);
}
Валидатор :)
+101.9
function DatePlusOneDay(Date: TDate): TDate;
var
Day, Month, Year: string;
begin
Day := Copy(DateToStr(Date), 1, 2);
Month := Copy(DateToStr(Date), 4, 2);
Year := Copy(DateToStr(Date), 7, 4);
if frac(StrToFloat(Year) / 4) <> 0 then
if (Month = '01') or (Month = '03') or (Month = '05') or (Month = '07') or (Month = '08') or (Month = '10') or (Month = '12') then
if Day <> '31' then
if StrToInt(Day) < 9 then Day := '0' + IntToStr(StrToInt(Day) + 1)
else Day := IntToStr(StrToInt(Day) + 1)
else
begin
Day := '01';
if StrToInt(Month) < 9 then
Month := '0' + IntToStr(StrToInt(Month) + 1)
else
if Month = '12' then
begin
Month := '01';
Year := IntToStr(StrToInt(Year) + 1);
end
else Month := IntToStr(StrToInt(Month) + 1);
end
else
if (Month = '04') or (Month = '06') or
(Month = '09') or (Month = '11') then
if Day <> '30' then
if StrToInt(Day) < 9 then Day := '0' + IntToStr(StrToInt(Day) + 1)
else Day := IntToStr(StrToInt(Day) + 1)
else
begin
Day := '01';
if StrToInt(Month) < 9 then Month := '0' + IntToStr(StrToInt(Month) + 1)
else Month := IntToStr(StrToInt(Month) + 1);
end
else
if Day <> '28' then
if StrToInt(Day) < 9 then Day := '0' + IntToStr(StrToInt(Day) + 1)
else Day := IntToStr(StrToInt(Day) + 1)
else
begin
Day := '01';
if StrToInt(Month) < 9 then Month := '0' + IntToStr(StrToInt(Month) + 1)
else Month := IntToStr(StrToInt(Month) + 1);
end
else
if (Month = '01') or (Month = '03') or (Month = '05') or (Month = '07') or (Month = '08') or (Month = '10') or (Month = '12') then
if Day <> '31' then
if StrToInt(Day) < 9 then Day := '0' + IntToStr(StrToInt(Day) + 1)
else Day := IntToStr(StrToInt(Day) + 1)
else
begin
Day := '01';
if StrToInt(Month) < 9 then
Month := '0' + IntToStr(StrToInt(Month) + 1)
else
if Month = '12' then
begin
Month := '01';
Year := IntToStr(StrToInt(Year) + 1);
end
else
Month := IntToStr(StrToInt(Month) + 1);
end
else
if (Month = '04') or (Month = '06') or
(Month = '09') or (Month = '11') then
if Day <> '30' then
if StrToInt(Day) < 9 then
Day := '0' + IntToStr(StrToInt(Day) + 1)
else
Day := IntToStr(StrToInt(Day) + 1)
else
begin
Day := '01';
if StrToInt(Month) < 9 then
Month := '0' + IntToStr(StrToInt(Month) + 1)
else
Month := IntToStr(StrToInt(Month) + 1);
end
else
if Day <> '28' then
if StrToInt(Day) < 9 then
Day := '0' + IntToStr(StrToInt(Day) + 1)
else
Day := IntToStr(StrToInt(Day) + 1)
else
begin
Day := '01';
if StrToInt(Month) < 9 then
Month := '0' + IntToStr(StrToInt(Month) + 1)
else
Month := IntToStr(StrToInt(Month) + 1);
end;
DatePlusOneDay := StrToDate(Day + '.' + Month + '.' + Year);
end;
Писалось, когда не знали о эквиваленте (Date + 1)