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

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

    +14

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    template<typename U>
    shared_ptr(const shared_ptr<U> & ptr) throw()
    	: m_value(0)
    	, m_ref_count(0)
    {
    	m_value = static_cast<T *>(ptr.get());
    	if(m_value)
    	{
    		m_ref_count = reinterpret_cast<const shared_ptr &>(ptr).m_ref_count;
    		++*m_ref_count;
    	}
    }

    Выражаясь метафорично, я работаю на велосипедном заводе.

    Xom94ok, 09 Июня 2013

    Комментарии (25)
  3. Java / Говнокод #13118

    +77

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (groundsDTO.isChildCome()) {
        ZAGSAffiliation.Grounds.CHILDCONSENT childConsest = grounds.addNewCHILDCONSENT();
        childConsest.setISCHILDCONSENT(groundsDTO.isChildAgreeWithFillation());
        if (!groundsDTO.isChildCome()) {
             tranferConfirmation(childConsest.addNewCONSENTNOTAR(),groundsDTO.getChildAgree());
        }
    }

    А вдруг ребенок все-таки не придет?

    killogramm, 06 Июня 2013

    Комментарии (25)
  4. C# / Говнокод #13090

    +126

    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
    <td width="150">\n\
        <% if (editableParts.warehouseAssignment || shipping_map.length > 1) { %>\n\
          <a class="shipping-map-link dashed" href="#">\n\
        <% } else { %>\n\
          <span class="grey">\n\
        <% } %>\n\
          <% if (shipping_map.length == 0) { %>\n\
            не указан</span>\n\
          <% } else { %>\n\
            <% if (shipping_map.length == 1) { %>\n\
              <%= shipping_map[0].warehouse.name %>\n\
            <% } else { %>\n\
              с нескольких складов\n\
            <% } %>\n\
          <% } %>\n\
        <% if (editableParts.warehouseAssignment) { %>\n\
          </a>\n\
        <% } else { %>\n\
          </span>\n\
        <% } %>\n\
    </td>\n\

    0x2f8f, 03 Июня 2013

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

    +11

    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
    template <class T>
    class autoptr
    {
      private:
        T * _ptr;
    
      public:
        autoptr()
        {
            _ptr = 0;
        }
    
        autoptr( T * ptr )
        {
            _ptr = ptr;
        }
    
        ~autoptr()
        {
            if(_ptr) delete _ptr;
        }
    
        operator T * ()
        {
            return _ptr;
        }
    
        T * operator -> ()
        {
            return _ptr;
        }
        T * get()
        {
            T *ret = _ptr;
            _ptr = 0;
            return ret;
        }
    };
    
    template <class T>
    class autoptr_mas
    {
    // ...

    НУ ЗАЧЕМ?!

    roman-kashitsyn, 01 Апреля 2013

    Комментарии (25)
  6. VisualBasic / Говнокод #12764

    −110

    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
    Select Case Figure mod 6  
     ...
     Case chsQueen 'Ферзь
       Picture.Line (X + 0.45 * Side, Y + 0.55 * Side)-(X + 0.5 * Side, Y + 0.15 * Side), Border
       Picture.Line (X + 0.55 * Side, Y + 0.55 * Side)-(X + 0.5 * Side, Y + 0.15 * Side), Border
       Picture.Circle (X + 0.5 * Side, Y + 0.15 * Side), 0.08 * Side, Border
       Picture.Line (X + 0.45 * Side, Y + 0.55 * Side)-(X + 0.3 * Side, Y + 0.25 * Side), Border
       Picture.Line (X + 0.35 * Side, Y + 0.6 * Side)-(X + 0.3 * Side, Y + 0.25 * Side), Border
       Picture.Circle (X + 0.3 * Side, Y + 0.25 * Side), 0.08 * Side, Border
       Picture.Line (X + 0.55 * Side, Y + 0.55 * Side)-(X + 0.7 * Side, Y + 0.25 * Side), Border
       Picture.Line (X + 0.65 * Side, Y + 0.6 * Side)-(X + 0.7 * Side, Y + 0.25 * Side), Border
       Picture.Circle (X + 0.7 * Side, Y + 0.25 * Side), 0.08 * Side, Border
       Picture.Line (X + 0.65 * Side, Y + 0.6 * Side)-(X + 0.85 * Side, Y + 0.35 * Side), Border
       Picture.Line (X + 0.73 * Side, Y + 0.65 * Side)-(X + 0.85 * Side, Y + 0.35 * Side), Border
       Picture.Circle (X + 0.85 * Side, Y + 0.35 * Side), 0.08 * Side, Border
       Picture.Line (X + 0.35 * Side, Y + 0.6 * Side)-(X + 0.15 * Side, Y + 0.35 * Side), Border
       Picture.Line (X + 0.27 * Side, Y + 0.65 * Side)-(X + 0.15 * Side, Y + 0.35 * Side), Border
       Picture.Circle (X + 0.15 * Side, Y + 0.35 * Side), 0.08 * Side, Border
       Picture.Line (X + 0.27 * Side, Y + 0.65 * Side)-(X + 0.27 * Side, Y + 0.8 * Side), Border
       Picture.Line (X + 0.73 * Side, Y + 0.65 * Side)-(X + 0.73 * Side, Y + 0.8 * Side), Border
       Picture.Circle (X + 0.5 * Side, Y + 0.35 * Side), 0.5 * Side, Border, 1.35 * Pi, 1.65 * Pi
       Call FloodFill(Picture.hdc, X + 0.5 * Side, Y + 0.5 * Side, Border)
       Picture.Circle (X + 0.5 * Side, Y + 1.24 * Side), 0.5 * Side, Border, 0.35 * Pi, 0.65 * Pi
       Picture.Circle (X + 0.5 * Side, Y + 1.1 * Side), 0.5 * Side, Border, 0.35 * Pi, 0.65 * Pi
       Picture.Line (X + 0.73 * Side, Y + 0.68 * Side)-(X + 0.65 * Side, Y + 0.7 * Side), Border
       Picture.Line (X + 0.73 * Side, Y + 0.77 * Side)-(X + 0.65 * Side, Y + 0.7 * Side), Border
       Picture.Line (X + 0.27 * Side, Y + 0.68 * Side)-(X + 0.35 * Side, Y + 0.7 * Side), Border
       Picture.Line (X + 0.27 * Side, Y + 0.77 * Side)-(X + 0.35 * Side, Y + 0.7 * Side), Border
       Picture.Line (X + 0.4 * Side, Y + 0.68 * Side)-(X + 0.5 * Side, Y + 0.63 * Side), Border
       Picture.Line (X + 0.4 * Side, Y + 0.68 * Side)-(X + 0.5 * Side, Y + 0.72 * Side), Border
       Picture.Line (X + 0.6 * Side, Y + 0.68 * Side)-(X + 0.5 * Side, Y + 0.63 * Side), Border
       Picture.Line (X + 0.6 * Side, Y + 0.68 * Side)-(X + 0.5 * Side, Y + 0.72 * Side), Border
       Let Picture.FillColor = Border
       Call FloodFill(Picture.hdc, X + 0.5 * Side, Y + 0.7 * Side, Border)
       Call FloodFill(Picture.hdc, X + 0.73 * Side, Y + 0.7 * Side, Border)
       Call FloodFill(Picture.hdc, X + 0.31 * Side, Y + 0.68 * Side, Border)
       Let Picture.FillColor = Fill
     ...
    End Select

    Пишу свои шахматы, с блекджеком и не без них.
    Вот, набацал алгоритм векторного рисования ферзя.
    Только на это ушло около получаса времени чистого с примесями (подстройки, мать их).
    Чую нутром, лучше забить и вырвать клипарт из интернета.

    ckopo, 18 Марта 2013

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

    +19

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    template<typename T>
    static json_string _itoa(T val) json_nothrow {  
            /*...*/
            long value = (long)val;
        
            /*...*/
    }

    Продолжаю бороться с поддержкой 64-битных чисел в libjson :/

    myaut, 30 Декабря 2012

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

    +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
    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
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    public OnPlayerSpawn(playerid) {
        IsSpawned[playerid]=1;
        if(Team[playerid]==ZOMBIE) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Zombie~w~. Kill & Infect every Human to complete your mission.");
    	} else if(Team[playerid]==HUMAN) { TextDrawSetString(Textdraw9[playerid],"You are a ~r~Human~w~. Prevent Zombie attacks and survive till the end."); }
        TextDrawHideForAll(Box); TextDrawHideForAll(text_Top5[0]); TextDrawHideForAll(text_Top5[1]);
    	TextDrawShowForPlayer(playerid, Textdraw0);	 TextDrawShowForPlayer(playerid, Textdraw1);
    	TextDrawShowForPlayer(playerid, Textdraw2);	 TextDrawShowForPlayer(playerid, Textdraw3);
    	TextDrawShowForPlayer(playerid, Textdraw4);	 TextDrawShowForPlayer(playerid, Textdraw5);
    	TextDrawShowForPlayer(playerid, Textdraw6);	 TextDrawShowForPlayer(playerid, Textdraw7);
    	TextDrawShowForPlayer(playerid, Textdraw9[playerid]);
    	TextDrawShowForPlayer(playerid, Textdraw15); TextDrawShowForPlayer(playerid, Textdraw16[playerid]);
    	SetTeam(playerid); SetClass(playerid); 
    	if(Infection==1) {
            Infection=0;
            if(Totalplayers>=2) {
    			SetTimer("InfectionLoad",0,0);
    		} else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=10) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=20) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=30) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=45) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers>=60) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}else if(Totalplayers<=75) {
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    			SetTimer("InfectionLoad",0,0);
    		}
    	} return 1; }

    Серьезно?

    d3n4, 08 Декабря 2012

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

    −120

    1. 1
    Мутабелен ли 1С.Овощи.Банан?

    Коллега считает что мутабелен.

    serpinski, 03 Декабря 2012

    Комментарии (25)
  10. PHP / Говнокод #11659

    +56

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function issets($text)
    	{
    	if (isset($text) && $text != '')
    		return 1;
    		else
    		return 0;
    	}

    По просьбам радиослушателей :) Отрывок из админки неизвестного автора.
    Кусочки http://govnokod.ru/11650 , http://govnokod.ru/11647 , http://govnokod.ru/11646

    kindofbear, 28 Августа 2012

    Комментарии (25)
  11. Java / Говнокод #11596

    +70

    1. 1
    2. 2
    3. 3
    4. 4
    if( (r == g) && (g == b) && (b == 255) )
    {
    // .....
    }

    ...

    Anderson, 15 Августа 2012

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