1. Лучший говнокод

    В номинации:
    За время:
  2. C++ / Говнокод #1207

    +13

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    class A
    {
    public:
    
      A& operator=(const A &a)
      {
        this->A::A(a);
        return *this;
      };
    // ...
    };

    Правильный оператор присваивания!

    guest, 16 Июня 2009

    Комментарии (14)
  3. PHP / Говнокод #1180

    +154

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    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>

    guest, 11 Июня 2009

    Комментарии (14)
  4. PHP / Говнокод #1116

    +144.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    $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']

    Кто-нибудь мне объяснит нахрена здесь второй цикл?

    guest, 31 Мая 2009

    Комментарии (14)
  5. VisualBasic / Говнокод #867

    −316.8

    1. 1
    2. 2
    3. 3
    If CLng(Text1.Text)<400 and CLng(Text1.Text)>400 then
       Text3.Text="17"
    End if

    и почему условие не проходит?

    guest, 14 Апреля 2009

    Комментарии (14)
  6. Pascal / Говнокод #794

    −107.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    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);

    доступ к указателям как к массивам

    guest, 31 Марта 2009

    Комментарии (14)
  7. C++ / Говнокод #776

    +141.4

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    int __fastcall TForm1::iscomm(AnsiString str)
    {
    int i=1;
    while (str[i]==' ')
     i++;
    if (str[i]=='#')
     {
      return 1;
     }
    else
     {
      return 0;
     };
    };

    borland C++.
    Функция определяет, является ли строка комментарием (начинается с #)

    guest, 26 Марта 2009

    Комментарии (14)
  8. Assembler / Говнокод #453

    +72.8

    1. 1
    2. 2
    mov ebx, eax
    mov eax, ebx

    Такое борландовский кодогенератор иногда выдаёт

    guest, 25 Января 2009

    Комментарии (14)
  9. C# / Говнокод #340

    +25

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    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;
                }
    }

    Зато красиво методы вызываются!

    guest, 07 Января 2009

    Комментарии (14)
  10. Си / Говнокод #50

    −1.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    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 часа ночи.
    На утро тихо матерился и переписывал всё

    guest, 02 Декабря 2008

    Комментарии (14)
  11. PHP / Говнокод #17

    +16

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
      // kuso@npj: спорная строка, но мне она нравится:
      error_reporting (E_ALL ^ E_NOTICE);
    
    
    
    

    guest, 27 Ноября 2008

    Комментарии (14)