1. C++ / Говнокод #2531

    +48.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    #define begin {
    #define end }
    //....
    #define repeat do{
    #define until(a) }while(!(a))
    // и т.д.

    Боян, конечно, просто вспомнил, глядя на предыдущий говнокод с макросами. Это в институте препод на одной из лекций всерьёз писал на доске.
    Видимо, паскальщик еще советской закалки :)

    GovnocoderJr, 02 Февраля 2010

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

    +144.7

    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
    #include <iostream>
    #define lulz int
    #define lulZ main()
    #define luLz {
    #define luLZ }
    #define lUlz cout
    #define lULz cin
    #define lUlZ ;
    #define LuLZ <<
    #define LuLz >>
    #define LULz =
    #define LULZ +
    #define lolz endl
    lulz lulZ
    luLz
      lulz Lulz lUlZ
      lUlz LuLZ" Смешная сумма " LuLZ lolz lUlZ
        lULz LuLz Lulz lUlZ
      lUlz LuLZ Lulz lUlZ
      lUlz LuLZ" + " lUlZ
    lulz lULZ lUlZ
      lUlz LuLZ "LULZ?" LuLZ lolz lUlZ
      lULz LuLz lULZ lUlZ
      lUlz LuLZ Lulz LuLZ " + " LuLZ lULZ LuLZ " = " LuLZ Lulz + lULZ lUlZ
    luLZ

    "Смешная сумма" (c) автор

    darkcheg, 02 Февраля 2010

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

    +63.8

    1. 1
    const size_t& len() const {return _c_str?_len:*(size_t*)0;} //нах это нужно??

    P.S. А Я САМ НЕ ЗНАЮ ГДЕ ЗДЕСЬ СИ-КРЕСТ-КРЕСТ!!!!1

    GovnocoderJr, 02 Февраля 2010

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

    +55.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
    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
    //------------------------------- COMPARE -------------------------------------
    // Function to compare two strings on a mask, using a question mark and
    // asterisk.Question mark matches any single character. The asterisk matches
    // any signs of a minimum length of zero. maximum length is not limited. Only
    // the next character in the mask has a value when there is a coincidence.
    int compare(const char pat[],const char text[],int rec_ex)
    {
        bool    flag = false;               // flag show if working on "star"
        int     pat_len ,txt_len,           // lehtghs of pattern and text
                flagc,                      // counter and  position i check
                shift=0;                    // shift position
    
        pat_len = (int)strlen(pat);         // get lehtgh of pattern
        txt_len = (int)strlen(text);        // get lehtgh of text
    
        if(rec_ex == 1 || (!pat_len && !txt_len))   // check if have to check some
            return(1);                      // if yes return 1 or if have exit
        else if(rec_ex == pat_len)          // else return 0 becose not check that
            return (0);                     // return 0
    
        for(flagc=0;flagc < pat_len;flagc++)
            if(pat[flagc] == '*' && flagc + 1 == pat_len)
                return(compare(pat,text,1));// end of check return 1
            else if(pat[flagc] == '*')
                flag = true;                // start * compare set flag true
            else if(pat[flagc] != '?')
            {
                if(toupper(pat[flagc]) != toupper(text[flagc+shift]) && !flag)
                    return(compare(pat,text,pat_len));   // bad char and no star
                else if(toupper(pat[flagc]) == toupper(text[flagc+shift]) && flag)
                    flag = false;                   // set flag false position
                else if(toupper(pat[flagc]) != toupper(text[flagc+shift]) && flag)
                    shift++;
            }
            else if(pat[flagc] == '?')
            {                               // check if have ? in star operation
                if(toupper(pat[flagc]) == toupper(text[flagc+shift]) && flag)
                    flag = false;           // set flag false position
                else if(toupper(pat[flagc]) != toupper(text[flagc+shift]) && flag)
                    shift++;                // add one more into shift
            }
        if((flagc+shift < txt_len && !flag) // text have nore chars and
            || (flagc+shift == txt_len +1 && pat[pat_len+1] != '*'))
            return(compare(pat,text,pat_len)); // and next char in pattern no star
        else
            return(compare(pat,text,1));       // end of pattern and text
    
    }

    Вот на после завтра нужно по программированию функцию написать- рекурсивную для сравнения строк по маске.
    Написал :-) якобы рекурсивную функцию :-)

    werd, 01 Февраля 2010

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

    +146.9

    1. 1
    2. 2
    3. 3
    4. 4
    class ToBeOrNotToBe{};
    void distortion(ToBeOrNotToBe...)
    {
    }

    Код компилируется в 2008 MVS

    Barmaglot, 28 Января 2010

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

    +72.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    this->pRCH->setChckSize(this->pRCH->getChckSize() + 
    this->pvRP->at(this->pvRP->size() - 1)->getRHBidR()->getRHBSize()
     + sizeof(*this->pvRP->at(this->pvRP->size() - 1)->getRHBidR()->getRHBid()));
    this->pRBCH->setChckSize(this->pRBCH->getChckSize() + 
    this->pvRP->at(this->pvRP->size() - 1)->getRHBR()->getRHB()->getRBSize());

    Автор кода отчаянно доказывал прямоту кода...

    Methos, 28 Января 2010

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

    +923.7

    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
    vector<
    #ifdef O_UNICODE
    wstring
    #else
    string
    #endif
    > get_file_list(
    #ifdef O_UNICODE
    wstring
    #else
    string
    #endif
    dir) {
    	#ifdef O_UNICODE
        wdirectory_iterator
        #else
        directory_iterator
        #endif
    	e;
        vector<
        #ifdef O_UNICODE
        wstring
        #else
        string
        #endif
        > ret;
        for (
        #ifdef O_UNICODE
        wdirectory_iterator
        #else
        directory_iterator
        #endif
    	d(dir); d != e; d++) {
            if (is_directory(d->status())) {
                vector<
                #ifdef O_UNICODE
                wstring
                #else
                string
                #endif
                > tmp = get_file_list(dir +
                #ifdef O_UNICODE
                L
                #endif
                "\\" + d->filename());
                for (unsigned int i = 0; i < tmp.size(); i++)
                    ret.push_back(tmp[i]);
            } else
                ret.push_back(dir +
                #ifdef O_UNICODE
                L
                #endif
                "\\" + d->filename());
        }
        return ret;
    }

    Условная компиляция, однако

    braindead, 28 Января 2010

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

    +144.2

    1. 1
    i+=i+++i--;

    Access denied!!!

    Говногость, 27 Января 2010

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

    +67.7

    1. 1
    for(__=_;__<___;__++) C++;

    Недавно увидел такие имена переменных, очарован, теперь срочно переделываю весь проект!

    PS. Тело цикла сами знаете для кого.

    nil, 27 Января 2010

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

    +58.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
    template <int n>
    struct fibonacci
    {
    	static int result()
    	{
    		return fibonacci<n-2>::result() + fibonacci<n-1>::result();
    	}
    };
    
    ........... и где-нибудь в коде:
    
    fibonacci<7>::result();

    Работает в msvc 2008 sp1 и более ранних. g++ и некоторые другие отваливаются с ругательствами на урезмерную рекурсию. Особо злостным маньякам можно рекомендовать понаслаждаться просмотром поля "memory usage" процесса cl.exe :)

    Также можно (но не нужно) устроить ddos подвесив халявный компилятор здесь:

    http://www.dinkumware.com/exam/default.aspx

    Гвозди Заржавелли, 26 Января 2010

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