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

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

    +109

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    BusinessLogic.Entity_InheritanceSetting.Save(
                        Session.SessionSettings.Settings.ContactID.Value,
                        Session.SessionSettings.Settings.SessionID.Value, copyID.Value,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                        true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

    kore_sar, 30 Сентября 2013

    Комментарии (84)
  3. C# / Говнокод #13589

    +124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    for (var i = 0; i < Collection.Count(); i++)
                    {
                        if (i==x)
                        {
                            Collection.Remove(i);
                        }
                    }

    Классика

    kegdan, 09 Августа 2013

    Комментарии (84)
  4. Си / Говнокод #11881

    +134

    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
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    // histogram_data.c   550 Kb
    int n_records = 100000;
    unsigned char data[] = {
      215, 100, 200, 204, 233, 50 , 85 , 196, 71 , 141, 122, 160, 93 , 131, 243, 234, 162, 183, 36 , 155, 
      4  , 62 , 35 , 205, 40 , 102, 33 , 27 , 255, 55 , 131, 214, 156, 75 , 163, 134, 126, 249, 74 , 197, 
      134, 197, 102, 228, 72 , 90 , 206, 235, 17 , 243, 134, 22 , 49 , 169, 227, 89 , 16 , 5  , 117, 16 , 
      60 , 248, 230, 217, 68 , 138, 96 , 194, 131, 170, 136, 10 , 112, 238, 238, 184, 72 , 189, 163, 90 , 
      176, 42 , 112, 225, 212, 84 , 58 , 228, 89 , 175, 244, 150, 168, 219, 112, 236, 101, 208, 175, 233, 
      123, 55 , 243, 235, 37 , 225, 164, 110, 158, 71 , 201, 78 , 114, 57 , 48 , 70 , 142, 106, 43 , 232, 
      26 , 32 , 126, 194, 252, 239, 175, 98 , 191, 94 , 75 , 59 , 149, 62 , 39 , 187, 32 , 203, 42 , 190, 
      19 , 243, 13 , 133, 45 , 61 , 204, 187, 168, 247, 163, 194, 23 , 34 , 133, 20 , 17 , 52 , 118, 209, 
      146, 193, 13 , 40 , 255, 52 , 227, 32 , 255, 13 , 222, 18 , 1  , 236, 152, 46 , 41 , 100, 233, 209, 
      91 , 141, 148, 115, 175, 25 , 135, 193, 77 , 254, 147, 224, 191, 161, 9  , 191, 213, 236, 223, 212, 
      250, 190, 231, 251, 170, 127, 41 , 212, 227, 19 , 166, 63 , 161, 58 , 179, 81 , 84 , 59 , 18 , 162, 
      57 , 166, 130, 248, 71 , 139, 184, 28 , 120, 151, 241, 115, 86 , 217, 111, 0  , 88 , 153, 213, 59 , 
      172, 123, 123, 78 , 182, 46 , 159, 10 , 105, 178, 172, 163, 88 , 47 , 155, 160, 187, 84 , 189, 51 , 
      235, 175, 167, 65 , 136, 22 , 66 , 224, 175, 23 , 28 , 92 , 147, 151, 170, 73 , 198, 73 , 84 , 48 , 
      251, 0  , 211, 84 , 48 , 111, 245, 235, 195, 178, 31 , 175, 98 , 198, 241, 234, 220, 52 , 203, 140, 
     // over 5000 строк подобного
    
    int expected_results[] = {
        404,   389,   376,   394,   376,   342,   364,   364,   383,   396, 
        412,   409,   394,   409,   405,   383,   379,   401,   377,   400, 
        383,   410,   386,   383,   418,   416,   406,   349,   390,   388, 
        393,   372,   386,   386,   400,   384,   404,   355,   400,   361, 
        398,   371,   389,   383,   406,   414,   364,   389,   418,   391, 
        404,   396,   390,   397,   375,   389,   387,   392,   368,   430, 
        407,   387,   380,   380,   383,   352,   386,   413,   435,   413, 
        358,   453,   436,   409,   419,   393,   423,   398,   407,   372, 
        399,   353,   370,   389,   399,   376,   395,   439,   412,   379, 
        404,   374,   392,   393,   366,   377,   374,   395,   402,   380, 
        422,   407,   379,   398,   376,   410,   376,   392,   374,   409, 
        415,   382,   411,   398,   379,   385,   383,   374,   421,   371, 
        359,   403,   373,   396,   365,   365,   382,   383,   352,   399, 
        367,   439,   401,   418,   407,   403,   392,   373,   385,   374, 
        389,   365,   414,   415,   360,   384,   387,   381,   400,   410, 
        400,   406,   385,   395,   373,   381,   419,   362,   383,   399, 
        424,   379,   394,   401,   371,   426,   376,   375,   383,   370, 
        405,   402,   372,   404,   364,   419,   390,   376,   368,   405, 
        393,   386,   402,   393,   420,   388,   380,   364,   412,   383, 
        411,   357,   412,   377,   346,   389,   380,   371,   393,   408, 
        386,   425,   392,   338,   373,   382,   380,   365,   379,   394, 
        379,   378,   415,   394,   352,   378,   417,   403,   407,   388, 
        390,   433,   352,   394,   398,   407,   397,   409,   419,   378, 
        387,   359,   406,   384,   403,   385,   411,   418,   408,   371, 
        384,   386,   392,   422,   377,   399,   364,   381,   362,   379, 
        393,   383,   381,   400,   434,   404};
    
    // example_vectors.c - 1.8 Mb
    int vector_size=100000;
    int vector_a[] = {
      215 , 100 , 200 , 204 , 233 , 50  , 85  , 196 , 71  , 141 , 122 , 160 , 93  , 131 , 243 , 234 , 162 , 183 , 36  , 155 , 
      4   , 62  , 35  , 205 , 40  , 102 , 33  , 27  , 255 , 55  , 131 , 214 , 156 , 75  , 163 , 134 , 126 , 249 , 74  , 197 , 
      134 , 197 , 102 , 228 , 72  , 90  , 206 , 235 , 17  , 243 , 134 , 22  , 49  , 169 , 227 , 89  , 16  , 5   , 117 , 16  , 
      60  , 248 , 230 , 217 , 68  , 138 , 96  , 194 , 131 , 170 , 136 , 10  , 112 , 238 , 238 , 184 , 72  , 189 , 163 , 90  , 
      176 , 42  , 112 , 225 , 212 , 84  , 58  , 228 , 89  , 175 , 244 , 150 , 168 , 219 , 112 , 236 , 101 , 208 , 175 , 233 , 
      123 , 55  , 243 , 235 , 37  , 225 , 164 , 110 , 158 , 71  , 201 , 78  , 114 , 57  , 48  , 70  , 142 , 106 , 43  , 232 , 
      26  , 32  , 126 , 194 , 252 , 239 , 175 , 98  , 191 , 94  , 75  , 59  , 149 , 62  , 39  , 187 , 32  , 203 , 42  , 190 , 
      19  , 243 , 13  , 133 , 45  , 61  , 204 , 187 , 168 , 247 , 163 , 194 , 23  , 34  , 133 , 20  , 17  , 52  , 118 , 209 , 
      146 , 193 , 13  , 40  , 255 , 52  , 227 , 32  , 255 , 13  , 222 , 18  , 1   , 236 , 152 , 46  , 41  , 100 , 233 , 209 , 
      91  , 141 , 148 , 115 , 175 , 25  , 135 , 193 , 77  , 254 , 147 , 224 , 191 , 161 , 9   , 191 , 213 , 236 , 223 , 212 , 
      250 , 190 , 231 , 251 , 170 , 127 , 41  , 212 , 227 , 19  , 166 , 63  , 161 , 58  , 179 , 81  , 84  , 59  , 18  , 162 , 
      57  , 166 , 130 , 248 , 71  , 139 , 184 , 28  , 120 , 151 , 241 , 115 , 86  , 217 , 111 , 0   , 88  , 153 , 213 , 59  , 
      172 , 123 , 123 , 78  , 182 , 46  , 159 , 10  , 105 , 178 , 172 , 163 , 88  , 47  , 155 , 160 , 187 , 84  , 189 , 51  , 
      235 , 175 , 167 , 65  , 136 , 22  , 66  , 224 , 175 , 23  , 28  , 92  , 147 , 151 , 170 , 73  , 198 , 73  , 84  , 48  , 
    
    // over 15000 cтрок

    - Сударь, вы изволили принять наркотических средств?
    - Чего?
    - Ты что, сука, упоротый?!

    denis90, 06 Октября 2012

    Комментарии (84)
  5. C++ / Говнокод #8312

    +1002

    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
    Нужно написать функцию, возводящую число в 10 степень.
    
    Но почему, мой сотрудник обязательно напишет
    double func (double a) {
    return a * a * a * a * a * a * a * a * a * a;
    }
    ??????
    
    А когда понадобится 11 степень, он сделает так:
    double func (double a, bool is11 = false) {
    if (is11 == true)
    return a * a * a * a * a * a * a * a * a * a * a;
    return a * a * a * a * a * a * a * a * a * a;
    }
    
    А когда появится 12 степень, знаете что произойдет?
    double func (double a, int stepen = 0) {
    switch (stepen) {
    case 0: return a * a * a * a * a * a * a * a * a * a; break;
    case 1: return a * a * a * a * a * a * a * a * a * a * a; break;
    case 2: return a * a * a * a * a * a * a * a * a * a * a; break;
    }
    return 0;
    }

    Источник: http://ibash.org.ru/quote.php?id=14755

    rat4, 27 Октября 2011

    Комментарии (84)
  6. Куча / Говнокод #6398

    +144

    1. 1
    http://nm.merz-akademie.de/~alexander.schlegel/pixeledit/pixeleditor2.php

    смотрите какой гений верстки пейсал ЭТО.

    TheHamstertamer, 19 Апреля 2011

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

    +122

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    if (0 == comparer.Compare(s, hash)) 
    { 
        return true; 
    } 
    else 
    { 
        return false; 
    }

    MSDN. Не то чтобы ГК, но как-то странно.

    andrewpey, 11 Декабря 2010

    Комментарии (84)
  8. C++ / Говнокод #4211

    +151

    1. 1
    2. 2
    3. 3
    char line[10];
    cout<<"Press any key to exit"<<endl;
    cin.getline(line,9);

    Очередной перл из решений кандидатских задач.
    Видимо в военное время количество символов, генерируемых одной клавишей, может достигать 9. :)

    Lexey, 09 Сентября 2010

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

    +160

    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
    void check( const elemType eps = std::numeric_limits<elemType>::epsilon() ){
          count = 4;
          int isAB=0, isAC=0, isAD=0, isBC=0, isBD=0, isCD=0;
          if(A==B) isAB = 1;
          if(A==C) isAC = 1;
          if(A==D) isAD = 1;
          if(B==C) isBC = 1;
          if(B==D) isBD = 1;
          if(C==D) isCD = 1;
          if(isAB) {B=C;C=D;--count;}
          if(isAC) {C=D;--count;}
          if(isAD) {--count;}
          if(isBC) {C=D;--count;}
          if(isBD) {--count;}
          if(isCD) {--count;}
          if(count<3){std::cerr <<"Warning: Bad Frame.\n";}
       }

    Есть структура. В ней четыре поля. Два любых поля могут совпадать, могут не совпадать. Если два поля совпадают, то лишнее нужно удалить и установить счетчик в 3. Если больше двух полей совпадают сообщить об ошибке. Как это попроще (покрасивше) это сделать в стиле cpp?

    blackhearted, 15 Июня 2010

    Комментарии (84)
  10. JavaScript / Говнокод #3400

    +159

    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
    function countInt(int32)
    {
    	var n = int32;
    	if (n == 0) n = 1;
    	n = Math.abs(n);
    	var len = 0;
    	while (n > 0)
    	{
        	len++;
        	n = n / 10;
    		n = parseInt(n); 
    	}
    	return len;
    }
    function zeroAdder(int32)
    {
    	var str = '';
    	if (countInt(int32) == 1) str = '0';
    	str = str + int32;
    	return str;	
    }
    function pasteDT()
    {
    	d = new Date();
    	$('#element_4_1').attr('value',zeroAdder(d.getDate()));
    	$('#element_4_2').attr('value',zeroAdder(d.getMonth()+1));
    	$('#element_4_3').attr('value',zeroAdder(d.getFullYear()));
    	$('#element_5_1').attr('value',zeroAdder(d.getHours()));
    	$('#element_5_2').attr('value',zeroAdder(d.getMinutes()));
    	
    }

    Короче код для заполнения полей формы датой и временем.
    Функция countInt - исчисляет количество цифр в целом числе, даже в отрицательном.
    Функция zeroAdder - добавляет 0, если допустим первое число (1). Преобразовывает его в строку '01'.
    Как вы увидели, я использую jQuery, хотя Prototype как-то удобнее.

    increazon, 05 Июня 2010

    Комментарии (84)
  11. Куча / Говнокод #29270

    0

    1. 1
    Пиздец-оффтоп #131

    #101: https://govnokod.ru/28949 https://govnokod.xyz/_28949
    #102: https://govnokod.ru/28978 https://govnokod.xyz/_28978
    #103: https://govnokod.ru/28982 https://govnokod.xyz/_28982
    #104: https://govnokod.ru/28989 https://govnokod.xyz/_28989
    #105: https://govnokod.ru/29052 https://govnokod.xyz/_29052
    #106: https://govnokod.ru/29069 https://govnokod.xyz/_29069
    #107: (vanished) https://govnokod.xyz/_29086
    #108: https://govnokod.ru/29102 https://govnokod.xyz/_29102
    #109: https://govnokod.ru/29126 https://govnokod.xyz/_29126
    #110: https://govnokod.ru/29136 https://govnokod.xyz/_29136
    #111: https://govnokod.ru/29142 https://govnokod.xyz/_29142
    #112: https://govnokod.ru/29155 https://govnokod.xyz/_29155
    #113: https://govnokod.ru/29160 https://govnokod.xyz/_29160
    #114: https://govnokod.ru/29165 https://govnokod.xyz/_29165
    #115: https://govnokod.ru/29173 https://govnokod.xyz/_29173
    #116: https://govnokod.ru/29174 https://govnokod.xyz/_29174
    #117: https://govnokod.ru/29182 https://govnokod.xyz/_29182
    #118: https://govnokod.ru/29191 https://govnokod.xyz/_29191
    #119: https://govnokod.ru/29196 https://govnokod.xyz/_29196
    #120: https://govnokod.ru/29205 https://govnokod.xyz/_29205
    #121: https://govnokod.ru/29216 https://govnokod.xyz/_29216
    #122: https://govnokod.ru/29219 https://govnokod.xyz/_29219
    #123: https://govnokod.ru/29232 https://govnokod.xyz/_29232
    #124: https://govnokod.ru/29237 https://govnokod.xyz/_29237
    #125: https://govnokod.ru/29239 https://govnokod.xyz/_29239
    #126: https://govnokod.ru/29244 https://govnokod.xyz/_29244
    #127: https://govnokod.ru/29248 https://govnokod.xyz/_29248
    #128: https://govnokod.ru/29251 https://govnokod.xyz/_29251
    #129: https://govnokod.ru/29257 https://govnokod.xyz/_29257
    #130: https://govnokod.ru/29266 https://govnokod.xyz/_29266

    nepeKamHblu_nemyx, 01 Июля 2026

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