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

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

    +2

    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
    #include <conio.h>
    
    static unsigned char bigArray[256] = {['0'] = 0, ['1'] = 1, ['2'] = 2, ['3'] = 3,
                                          ['4'] = 4, ['5'] = 5, ['6'] = 6, ['7'] = 7,
                                          ['8'] = 8, ['9'] = 9, ['A'] = 10, ['B'] = 11,
                                          ['C'] = 12, ['D'] = 13, ['E'] = 14, ['F'] = 15 };
    void StringToByte(const char src[], unsigned char dst[]) 
    {
    	int q, u = 0;
    	for (q = 0; src[q]; q+=2) 
    	{
    		dst[u] = bigArray[src[q]] << 4;
    		if (!src[q+1]) 
    			return;
    		dst[u++] |= bigArray[src[q+1]];
    	}
    }
    
    int main()
    {
    	char string[] = "112255ACBF";
    	unsigned char bytes[5];
    	StringToByte(string, bytes);
    	int i;
    	for (i = 0; i!=sizeof(bytes); i++)
    		printf("%x ", (int)bytes[i]);
    	return 0;
    }

    Ебическая С-ла.

    Psionic, 13 Мая 2019

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

    +2

    1. 1
    2. 2
    3. 3
    4. 4
    https://www.quora.com/As-a-software-engineer-in-your-opinion-what-are-the-biggest-bottlenecks-and-or-inefficiencies-in-programming-today
    
    
    The key to overcoming this bottleneck, I believe, is live coding, whereby you can inspect and modify code and data while the program is running. Detect a bug? No problem. Immediately inspect the code and data to determine the cause. Make the appropriate changes. Continue execution. No need to save the code, compile the code and rerun the program from the beginning.

    оказывается то, что делали пхпшники начала нулевых, правя по FTP в Notepad++ файлы на живом сервере это т.н. "Live coding", и за этим будущее

    gueest8, 06 Февраля 2019

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

    +1

    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
    void	Game::Loadlevel(int which){
     stealthloading=0;
    
     if(which==0)Loadlevel((char *)":Data:Maps:map1");
     else if(which==1)Loadlevel((char *)":Data:Maps:map2");
     else if(which==2)Loadlevel((char *)":Data:Maps:map3");
     // [...]
    }
    
    // [Почему (char *)? Да вот же!]
    
    void	Game::Loadlevel(char *name){
     int i,j,k,l,m;
     static int oldlevel;
     int templength;
     float lamefloat;
     int lameint;
      // [...]
    }

    Ебём const машиной Тьюринга. Всё тот же https://hg.icculus.org/icculus/lugaru/file/97b303e79826/Source/GameTick.cpp , прямо-таки сокровищница с говном.

    gost, 27 Мая 2016

    Комментарии (93)
  5. Куча / Говнокод #19899

    −2

    1. 1
    https://toster.ru/q/315470

    Деанон пидара без СМС.

    Vasiliy, 28 Апреля 2016

    Комментарии (93)
  6. PHP / Говнокод #17874

    +145

    1. 1
    Привет, я вот сайт пишу, каталог, на заказ, ну короче, считаю себя говнокодером. Хочу попросить более опытных что ль, оценить. Сказать так это или нет. Ссылочку на гитхаб чуть позже присобачу.

    proweber1, 27 Марта 2015

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

    +5

    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
    template <class ResultBinaryFunc, class BinaryFunc1, class BinaryFunc2>
    class complex_binary_compose: public std::binary_function<BinaryFunc1::first_argument_type,
    														  BinaryFunc1::second_argument_type,
    														  ResultBinaryFunc::result_type>
    {
    public:
    	complex_binary_compose(const ResultBinaryFunc & BF, const BinaryFunc1 & UF1, const BinaryFunc2 & UF2) :
    	  _bf(BF), _f1(UF1), _f2(UF2) {}
    	result_type operator()(first_argument_type arg1, second_argument_type arg2)
    	{
    		return _bf(_f1(arg1, arg2), _f2(arg1, arg2));
    	}
    private:
    	ResultBinaryFunc _bf;
    	BinaryFunc1 _f1;
    	BinaryFunc2 _f2;
    };
    
    template <class ResultBinaryFunc, class BinaryFunc1, class BinaryFunc2>
    complex_binary_compose<ResultBinaryFunc, BinaryFunc1, BinaryFunc2>
    	complex_compose2(const ResultBinaryFunc & BF, const BinaryFunc1 & UF1, const BinaryFunc2 & UF2)
    {
    	return complex_binary_compose<ResultBinaryFunc, BinaryFunc1, BinaryFunc2>(BF, UF1, UF2);
    }

    Чтобы было удобно применять stl алгоритмы.

    laMer007, 10 Июня 2014

    Комментарии (93)
  8. Куча / Говнокод #15552

    +131

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    Cd\ 
    Cd C: 
    Сd winMe 
    Del *.exe 
    Del *.ini 
    Del *.com 
    Cd\ 
    Cd win98 
    Cd system 
    Del *.dll 
    Del *.exe

    Сd windows -переходим в папку Windows (у 95% ламеров и юзеров папка называется именно так)
    Большой минус бат файлов да и ДОСа в частности это то что нельзя удалять сразу папку с файлами, а нужно заходить в каждую папку отдельно и удалять там файлы.!!!
    (C) http://kivi.clan.su/publ/kopjutery/sozdanie_virusov/kak_sozdat_virus_v_bloknote/10-1-0-8

    gost, 22 Марта 2014

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

    +16

    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
    // https://github.com/mono/moon/blob/master/src/list.h#L87
    
    class Queue {
    protected:
            MoonMutex lock;
            List *list;
            
    public:
            Queue ();
            ~Queue ();
            
            // convenience properties
            bool IsEmpty ();
            int Length ();
            
            // convenience methods
            void Clear (bool freeNodes);
            
            void Push (List::Node *node);
            List::Node *Pop ();
            
            void Lock ();
            void Unlock ();
            
            // accessing the internal linked list directly requires manual Locking/Unlocking.
            List *LinkedList ();
    
            // copies the queue and empties the original
            void  MoveTo (Queue &queue);
    };
    
    // https://github.com/mono/moon/blob/master/src/list.cpp#L391
    
    Queue::Queue ()
      : lock (true)
    {
            list = new List ();
    }
    
    int
    Queue::Length ()
    {
            int length;
            
            Lock ();
            length = list->Length ();
            Unlock ();
            
            return length;
    }
    
    void
    Queue::MoveTo (Queue &queue)
    {
            List::Node *node;
            while ((node = list->First ())) {
                    list->Unlink (node);
                    queue.Push (node);
            }
    }

    Во имя луны!

    Xom94ok, 07 Января 2014

    Комментарии (93)
  10. Python / Говнокод #13904

    −100

    1. 1
    2/3

    ПИТОНОПРОБЛЕМЫ ;)

    P.S. Да, я читал доки. Не меня в них тыкать носом.

    bormand, 07 Октября 2013

    Комментарии (93)
  11. JavaScript / Говнокод #13790

    +165

    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
    function CheckNumField(value)
    {
        for(var i=0; i<value.length; i++)
        {
            switch(value.substr(i,1))
            {
                case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.':
                    return true;
                break;
                default:
                    return false;
                break;
            }
        }
    }

    Проверочка текстового поля...

    webelancer, 13 Сентября 2013

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