-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+144.8
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
FUNCTION PCHARTOSTRING(pc:pchar):string;
VAR
s:string;
//P:PCHAR;
I:word;
//O:WORD;
BEGIN
FOR I:=1 TO 255 DO
begin
if pc[i]=#0 then
s[i]:=pc[i-1];
begin
setlength(s,i);
PCHARTOSTRING:=s;
exit;
end;
end;
setlength(s,255);
PCHARTOSTRING:=s;
END;
И это в Дельфи. O_o
Говногость,
13 Марта 2010
-
−366.8
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Public Overrides Function DataChanged() As Boolean
Const CONST_PROC_NAME = "DataChanged"
Try
Return False
Catch objExcp As Exception
Me.DisplayMessageBox("Unexpected Exception in " & CONST_CLASS_NAME & "." & CONST_PROC_NAME & " : " & objExcp.Message.ToString, MessageBoxIcon.Error)
End Try
End Function
По суровому закону нашего проекта каждая функция должна быть обернута ловлей эксепшиона. Каждая. Всегда.
6istik,
24 Ноября 2009
-
+132.3
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
char *uart_readln_timeout(UART_HANDLE h, char *buf, uint16_t len, clock_tick_t to)
{
clock_tick_t finish_time;
char *datap = buf;
char *datae = buf + len - 1;
if( len == 0 ) return buf;
if( len == 1 ) {
buf[0] = 0;
return buf;
}
finish_time = clock_get_millis() + to;
// FIXME!!!
while( datap < datae && ( to == 0 || clock_get_millis() < finish_time ) ) {
if( uart_read_char(h, datap) ) {
if( *datap++ == '\n' ) break;
}
}
*datap = 0;
return buf;
}
читает строку из UART. есть подозрение, что это говнокод.
dmzlj.livejournal.com,
24 Октября 2009
-
+155.3
- 1
- 2
- 3
- 4
- 5
- 6
- 7
function gp($gp){
$gp_res=$_GET[$gp];
if ($gp_res == ''){
$gp_res=$_POST[$gp];
}
return $gp_res;
}
а поидее можно было юзать $_REQUEST[$gp]
popstas,
21 Октября 2009
-
+144.7
- 1
- 2
- 3
- 4
<form ....
<a href="#" class="lalalala" onclick="$('#frm').submit()">Подтвердить</a>
...
</form>
изначально было так
в админке ))
paranoid,
21 Октября 2009
-
+144.8
- 1
- 2
$uploaddir = '../images/';
$uploadfile1 = $uploaddir . basename($_FILES['img']['name']);
все те же индусы
getme,
16 Октября 2009
-
+56.6
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
class inTm: public ioTm
{ public: inTm(){ startInTm(); buffer=temp; };
int readTm (tmData&);
virtual void message(const structMessage&){};
void inputArray (int);
void setNonBlock(int);
void startInTm();
long readTmPos(tmData&);
protected:
unsigned char temp[lengthBuffer];
virtual unsigned char* readBuffer(int&)=0;
int inputBuffer();
void convertTm(unsigned char*, tmData&);
virtual long getPos(){ return current-count-countTemp; };
private:
void cnvTmPC (unsigned char*, tmData&);
void cnvTmNet (unsigned char*, tmData&);
friend inTmBl;
friend finTm;
int count;
int lengthIn;
unsigned char* tempBuf;
int countTemp;
};
Программист Мудрецов (фамилия у человека такая) был большим затейником. Например, код на С++ в хидерах он формативровал по центру - как стихи.
P. S. Надеюсь, на сайте форматирование сохранится.
Dimarius,
01 Сентября 2009
-
+176.4
- 1
- 2
- 3
- 4
- 5
- 6
if($n==1 or $n==3 or $n==3 or $n==4 or $n==5) {
if($n ==1 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 1c='1' and id_sett='1'");}
if($n ==2 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 2c='1' and id_sett='1'");}
if($n ==3 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 3c='1' and id_sett='1'");}
if($n ==4 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 4c='1' and id_sett='1'");}
if($n ==5 ) {$result = mysql_query("SELECT * FROM spec WHERE id_fac='$id_fac' and 5c='1' and id_sett='1'");}}
кусок из примера кода, который чувак прислал к нам в контору вместе с резюме
nolka4,
21 Августа 2009
-
+137
- 1
- 2
- 3
- 4
- 5
- 6
if (messages[i].description != "")
if (messages[i].description.StartsWith("<![CDATA["))
{
messages[i].description = messages[i].description.Substring(9);
messages[i].description = messages[i].description.Substring(0, messages[i].description.Length - 3);
}
для строк типа <![CDATA[******]!>
Возникает устойчивое ощущение говнокода. Как нормально написать? :)
ikovalyov,
16 Августа 2009
-
+133.1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
/// <summary>
/// General handler for all buttons
/// </summary>
private void FormButtons_Click(object sender, EventArgs e)
{
Control control = (Control) sender;
if (control.Handle == btnCreateInvoices.Handle)
ExportOrders();
else if (control.Handle == btnFirstUsageInvoices.Handle)
ExportFirstUsageInvoices();
else if (control.Handle == btnImportCustomers.Handle)
ImportCustomers();
else if (control.Handle == btnImportProdcuts.Handle)
ImportProducts();
else if // и так далее...
}
WinForms приложение, на все кнопки навешен 1 обработчик события OnClick.
А внутри вот....
vleschenko,
12 Августа 2009