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

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

    +27.2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if (IFabrica::First == NULL)
    {
    	this->link = IFabrica::First;
    	IFabrica::First = this;
    }

    guest, 07 Июня 2009

    Комментарии (0)
  3. JavaScript / Говнокод #375

    +27.1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    function getalignurl(align)
    {
      var n=parseFloat(align);
      return "http://не_палим_домен."+language+"/какой-то_файл.html";
    }

    может я чет не понимаю...

    guest, 12 Января 2009

    Комментарии (2)
  4. Куча / Говнокод #20471

    +27

    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
    Вскрытие покровов:
    Я есмъ
    
    LispGovno
    HaskellGovno
    laMer007
    macGovno
    LinuxGovno
    C_Plus_Plus_Govno
    CKrestKrestGovno
    CPPGovno
    AnimeGovno-_-
    lucidfoxGovno
    dosGovno
    RS-232
    IKing
    и др.

    Я регал несколько пользователей guest в том числе с юникодными e и аватарками гостя. Что-то из них удалили, что-то переименовали в fake_guest или даже просто сменили аватарку.

    Не всё писал я, так как от каких-то из аккаунтов я выкладывал пароли,
    какие-то из них взламывали и\или как-то выкладывали пароли на некий сайт bugmenot (до сих пор не знаю как они туда попадали).

    У меня 320 номер юзера и я был здесь, когда зарегистрированных юзеров здесь еще не было.
    Кто-то даже считает меня страйкером.

    Я даже девственник.
    Задавайте свои вопросы.

    Говногость, 05 Августа 2016

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

    +27

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    @@ -50,9 +50,6 @@ void AreaTrigger::RemoveFromWorld()
          ///- Remove the AreaTrigger from the accessor and from all lists of objects in world
          if (IsInWorld())
          {
     -        if (!IsInWorld())
     -            return;
     -
              WorldObject::RemoveFromWorld();
              sObjectAccessor->RemoveObject(this);
          }

    "Core/AreaTrigger: Remove useful check"
    https://github.com/TrinityCore/TrinityCore/commit/d920463fe5fe6eee7c4a8e2d777720fcfbe6f08f

    Actine, 13 Июля 2014

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

    +27

    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
    98. 98
    99. 99
    #include <iostream>
    #include <iterator>
    #include <algorithm>
    #include <vector>
    #include <utility>
    #include <sstream>
    #include <assert.h>
    using namespace std;
    
    struct PeriodDescription{
    	size_t length, repeat_amount, last_items_amount;
    	/*friend ostream& operator<<(ostream& os, const PeriodDescription& s){
    		os<<" (PeriodDescription){"<<s.length<<", "<<s.repeat_amount<<", "<<s.last_items_amount<<"} ";
    		return os;
    	}*/
    };
    
    /*template<class C>
    string co(C&& c){
    	ostringstream r;
    	r<<" (C) {";
    	copy(c.begin(), c.end(), ostream_iterator<typename C::value_type>(r, ", "));
    	r<<"}; ";
    	return move(r.str());
    }*/
    
    vector<PeriodDescription> find_repeat_sequences_since_begin(const string& sequence){
    	vector<PeriodDescription> result;
    	if(sequence.empty())
    		return result;
    	auto position_at_last_period=sequence.begin();
    	const char first_item = *position_at_last_period;
    	const auto after_last=sequence.end();
    	auto position_at_current_period = position_at_last_period;
    	while(true){
    		position_at_last_period=sequence.begin();
    		position_at_current_period = find(next(position_at_current_period), after_last, first_item);
    		PeriodDescription new_period {size_t(distance(position_at_last_period, position_at_current_period)), 1, 0};
    		while(position_at_current_period!=after_last && *position_at_last_period==*position_at_current_period){
    			++position_at_last_period; ++position_at_current_period;
    			if(++new_period.last_items_amount>=new_period.length){
    				new_period.last_items_amount = 0;
    				++new_period.repeat_amount;
    			}
    		}
    		if(new_period.repeat_amount==1 && new_period.last_items_amount==0)
    			return result;
    		result.push_back(new_period);
    		if(position_at_current_period==after_last)
    			return result;
    	}
    }
    
    vector<size_t> generate_FSM_failJumpIndices(const vector<PeriodDescription>& periodDescriptions, const size_t stringLength){
    	vector<size_t> r(stringLength+1);
    	for(const auto& pd : periodDescriptions){
    		for(size_t periodIndex=1; periodIndex<pd.repeat_amount; ++periodIndex)
    			for(size_t indexAtPeriod=0; indexAtPeriod<pd.length; ++indexAtPeriod)
    				r[(periodIndex*pd.length)+indexAtPeriod]=(periodIndex-1)*pd.length + indexAtPeriod;
    		for(size_t indexAtAfterPeriods=0; indexAtAfterPeriods<pd.last_items_amount; ++indexAtAfterPeriods)
    			r[pd.length*pd.repeat_amount+indexAtAfterPeriods]=pd.length*(pd.repeat_amount-1)+indexAtAfterPeriods;
    	}
    	return r;
    }
    
    vector<size_t> make_FSM_failJumpIndices(const string& sequence){
    	return generate_FSM_failJumpIndices(find_repeat_sequences_since_begin(sequence), sequence.size());
    }
    
    class FSM_for_find_equal_ranges{
    	size_t state;
    	vector<size_t> failJumpIndices;
    	string sequence;
    	string::const_iterator find_next(string::const_iterator checkPosition, const string::const_iterator last){
    		struct atReturn{
    			size_t& state;
    			~atReturn(){state = 0;}
    		}nullify{state};
    		if(checkPosition==last)
    			return last;
    		if(sequence.empty())
    			return next(checkPosition);
    		if(size_t(distance(checkPosition, last))<sequence.size())
    			return last;
    		while(true){
    			if(checkPosition==last)
    				return last;
    			if(*checkPosition==sequence[state])
    				++state;
    			else
    				state=failJumpIndices[state];
    			++checkPosition;
    			if(state>=sequence.size())
    				return prev(checkPosition, sequence.size());
    		}
    	}
    public:
    	template<class T>
    	FSM_for_find_equal_ranges(T&& sequence):

    Очередное собеседование. Пригласили на должность дельфина. Но оп отказался проходить собеседование на дельфи.
    http://ideone.com/zp5CRb

    USB, 07 Марта 2014

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

    +27

    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
    int enumDevices(DevInfo* &lst) {
        int count = 0;
        DevInfo* tmp = NULL;
        Device device;
        for (int i = 0; i < MAXDEVICES; i++)
            if (device = OpenDevice(i)) {
                count++;
                realloc(tmp, sizeof(DevInfo)*count);
                ReadInfo(device, &tmp[count-1]
            }
        if (count == 0) return 0;
        lst = new DevInfo[count];
        for (int i = 0; i < count; i++)
            lst[i] = tmp[i];
        free(tmp);
        return count;
    }
    
    //................
    
    DevInfo* list;
    int devcount = enumDevices(list);
    /* работаем со списком */
    delete[] list;

    Самому стыдно.

    Vindicar, 06 Января 2014

    Комментарии (95)
  8. PHP / Говнокод #13916

    +27

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    function makehash($str,$salt='',$strength='08'){
    	if (!$salt):
    		  $salt = "";
    		  for ($i = 0; $i < 22; $i++) {
    		    $salt .= substr("./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", mt_rand(0, 63), 1);
    		  }
    	endif;
        return crypt($str, "$2a$".$strength."$".$salt);
    }

    no comments

    brainstorm, 09 Октября 2013

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

    +27

    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
    //Определение рангов узлов
      NL1=NL2=0; int msKl1,kl1I1;
     M6: NL1=NL1+NL2; FormMS(NL1,MS); K9=NO-NL1; KSS=32767*32767*2;
      for(J=2;J<=K9;J++)
        {KS[J]=KU1[J]*(KU1[J]-1)/2;
         if(KS[J] != 0)
          {L6=KU2[J-1]+1; L8=KU2[J]; L7=L8-1;
           for(I1=L6;I1<=L7;I1++)
             {II2=I1+1; kl1I1=KL1[I1];
              for(I2=II2;I2<=L8;I2++)
                {msKl1=MS[KL1[I2]];
                 L61=KU2[msKl1-1]+1; L71=KU2[msKl1];
                 for(L=L61;L<=L71;L++)
                   {if(KL1[L] != kl1I1)goto M10;
                    else { KS[J]--; goto M9;}
               M10:;}
             M9:;}
             }
          }
          if(KS[J] < KSS) KSS=KS[J];
        }
    //=================

    куски кода какой-то очень древней расчетной программы. Радует форматирование

    mapron, 01 Марта 2013

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

    +27

    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
    inline double poly(double x, const double *c, int k) const {
            double y = c[k];
            switch (k) {
                case 15: y = y * x + c[14];
                case 14: y = y * x + c[13];
                case 13: y = y * x + c[12];
                case 12: y = y * x + c[11];
                case 11: y = y * x + c[10];
                case 10: y = y * x + c[ 9];
                case  9: y = y * x + c[ 8];
                case  8: y = y * x + c[ 7];
                case  7: y = y * x + c[ 6];
                case  6: y = y * x + c[ 5];
                case  5: y = y * x + c[ 4];
                case  4: y = y * x + c[ 3];
                case  3: y = y * x + c[ 2];
                case  2: y = y * x + c[ 1];
                case  1: y = y * x + c[ 0];
                case  0: break;
            }
            return y;
        }

    Схема Горнера для вычисления значения многочлена в точке

    uranix, 08 Февраля 2013

    Комментарии (20)
  11. C++ / Говнокод #11943

    +27

    1. 1
    cout<<!0&&0;

    Что вернет?
    1) 1||0&&0
    2) !0&&0
    3) Приоритет оператора "!" ?
    http://ideone.com/hHdZ1
    http://ideone.com/s8Cj0


    Сории за толстейший троллинг.

    LispGovno, 17 Октября 2012

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