- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
class A
{
public:
A& operator=(const A &a)
{
this->A::A(a);
return *this;
};
// ...
};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+13
class A
{
public:
A& operator=(const A &a)
{
this->A::A(a);
return *this;
};
// ...
};
Правильный оператор присваивания!
+154
Html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
<head>
<title>I LOVE ZEND FRAMEWORK!</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="/zend/public/design/css/style.css" media="screen" rel="stylesheet" type="text/css" /> <link href="/zend/public/design/css/style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/zend/public/design/css/teststyle.css" media="screen" rel="stylesheet" type="text/css" /></head>
<body>
PHP:
<?php echo $this->doctype(Zend_View_Helper_Doctype::XHTML1_TRANSITIONAL); ?>
<html>
<head>
<?php echo $this->headTitle('I LOVE ZEND FRAMEWORK!'); ?>
<?php echo $this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8'); ?>
<?php echo $this->headLink()->appendStylesheet($this->baseUrl . 'design/css/style.css'); ?>
<?php echo $this->headLink()->appendStylesheet($this->baseUrl . 'design/css/teststyle.css'); ?>
</head>
+144.1
$query = "SELECT `parent_id` FROM `items` WHERE `id`='".$_GET['id']."'";
$result = mysql_query($query);
$result = mysql_fetch_assoc($result);
$parent_id = $result[0]['parent_id']
$query = "SELECT `id` FROM `catalog` WHERE `id`='".$parent_id."'";
$result = mysql_query($query);
$result = mysql_fetch_assoc($result);
$catalog_id = $result[0]['id']
Кто-нибудь мне объяснит нахрена здесь второй цикл?
−316.8
If CLng(Text1.Text)<400 and CLng(Text1.Text)>400 then
Text3.Text="17"
End if
и почему условие не проходит?
−107.4
w := ord(CHar(Pbyte(Pointer(Integer(IN_BUFFER)+ inpos))^));
s := ord(Char(Pbyte(Pointer(Integer(IN_BUFFER)+ inpos + 1))^));
PByte(Pointer(Integer(out_buf)+ outpos))^ := w and 255; {?????? ?? ?????? ??????}
PByte(Pointer(Integer(out_buf)+ outpos + 1))^ := w shr 8;
PByte(Pointer(Integer(out_buf)+ outpos))^ := PByte(Pointer(Integer(out_buf)+ outpos))^ or ((W and 15) shl 4);
доступ к указателям как к массивам
+141.4
int __fastcall TForm1::iscomm(AnsiString str)
{
int i=1;
while (str[i]==' ')
i++;
if (str[i]=='#')
{
return 1;
}
else
{
return 0;
};
};
borland C++.
Функция определяет, является ли строка комментарием (начинается с #)
+72.8
mov ebx, eax
mov eax, ebx
Такое борландовский кодогенератор иногда выдаёт
+25
private void OnRdbDatesCheckedChanged(object sender, EventArgs e)
{
if (rdbMonth.Checked)
MakeDateViewVisible("month");
else if (rdbQuarter.Checked)
MakeDateViewVisible("quarter");
else if (rdbYear.Checked)
MakeDateViewVisible("year");
else
MakeDateViewVisible("individual");
}
private void MakeDateViewVisible(string dateView)
{
switch (dateView)
{
case "year":
YearView.Visible = true;
QuarterView.Visible = false;
MonthView.Visible = false;
IndividualDatesView.Visible = false;
break;
case "quarter":
YearView.Visible = false;
QuarterView.Visible = true;
MonthView.Visible = false;
IndividualDatesView.Visible = false;
break;
case "month":
YearView.Visible = false;
QuarterView.Visible = false;
MonthView.Visible = true;
IndividualDatesView.Visible = false;
break;
case "individual":
YearView.Visible = false;
QuarterView.Visible = false;
MonthView.Visible = false;
IndividualDatesView.Visible = true;
break;
}
}
Зато красиво методы вызываются!
−1.5
void DictionaryEnumeratorFunction(char *val, void *tag)
{
DictionaryEnumeratorData ***data;
data = (DictionaryEnumeratorData***) tag;
(**data) = malloc(sizeof(DictionaryEnumeratorData));
(**data)->val = malloc(0); /* O_o [комент добавлен много позднее] */
strcpy((**data)->val, val);
(**data)->next = NULL;
*data = &((**data)->next);
}
Код, забивающий в массив данные из словаря (ассоциативного массива), путём рекурсивного обхода и вызова ЭТОГО. Писалось в 3 часа ночи.
На утро тихо матерился и переписывал всё
+16
// kuso@npj: спорная строка, но мне она нравится:
error_reporting (E_ALL ^ E_NOTICE);