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

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

    +113

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    private static Predicate<Token> GetMatchBracePredicate(Token token)
            {
                if (token is Token.BeginBrace)
                    return delegate(Token t) { return t is Token.BeginBrace; };
                if (token is Token.BeginQuote)
                    return delegate(Token t) { return t is Token.BeginQuote; };
                if (token is Token.BeginRound)
                    return delegate(Token t) { return t is Token.BeginRound; };
                if (token is Token.BeginSquare)
                    return delegate(Token t) { return t is Token.BeginSquare; };
           // ...

    С просторов интернета.

    Говногость, 16 Июня 2010

    Комментарии (67)
  3. SQL / Говнокод #1942

    −154.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    create table user.profile (
      ...
      gender boolean,
      ...
    )

    Очевидно, true - это мужик :D

    Suor, 06 Октября 2009

    Комментарии (67)
  4. VisualBasic / Говнокод #1729

    −115.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
    49. 49
    50. 50
    51. 51
    #Region "КОНСТАНТЫ ЭЛЕМЕНТОВ И АТТРИБУТОВ EXCEL"
        Public Const STYLE_DEFAULT As String = "Default"
        Public Const STYLE_ROW_VAC As String = "RvaC"
        Public Const STYLE_COLUMN As String = "Column"
        Public Const STYLE_f7I_bN_vaC_haL_n As String = "f7IbNvaChaL"
        Public Const STYLE_f7_bN_vaC_haL_nS As String = "f7bNvaChaLnS"
        Public Const STYLE_f7_bN_vaC_haR_nS As String = "f7bNvaChaRnS"
        Public Const STYLE_f7U_bl1r1Dt2_vaC_haL_n As String = "f7Ubl1t2r1DvaChaL"
        Public Const STYLE_f7_bl1Dr1t2_vaC_haL_n As String = "f7bl1Dr1t2vaChaL"
        Public Const STYLE_f7_br1D_vaC_haL_n As String = "f7br1DvaChaL"
        Public Const STYLE_f7_bl1Dr1_vaC_haL_nP As String = "f7bl1Dr1vaChaLnP"
        Public Const STYLE_f12B_bN_vaC_haL_n As String = "f11BbNvaChaL"
        Public Const STYLE_f12_bN_vaC_haL_n As String = "f11bNvaChaL"
        Public Const STYLE_f7_bN_vaT_haL_n As String = "f7bNvaThaL"
        Public Const STYLE_f12B_bl1r1t2_vaC_haL_n As String = "f11Bbl1r1t2vaChaL"
        Public Const STYLE_f7B_bN_vaC_haR_nS As String = "f7BvaChaRnS"
        Public Const STYLE_f7_bN_vaC_haC_n As String = "f7bNvaChaC"
        Public Const STYLE_f7B_bN_vaC_haL_nS As String = "f7BbNvaChaLnS"
        Public Const STYLE_f7B_bN_vaC_haC_n As String = "f7BbNvaChaC"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haC_n As String = "f7Bbl1r1t1b1vaChaC"
        Public Const STYLE_f7B_bl1_vaC_haL_n As String = "f7bl1vaChaL"
        Public Const STYLE_f7B_bt2_vaC_haL_nS As String = "f7Bbt2vaChaLnS"
        Public Const STYLE_f7B_bt2_vaC_haC_n As String = "f7Bbt2vaChaC"
        Public Const STYLE_f7B_bt2_vaC_haR_nS As String = "f7Bbt2vaChaRnS"
        Public Const STYLE_f7_bl1r1t2b1_vaC_haC_nS As String = "f7bl1r1t2b1vaChaCnS"
        Public Const STYLE_f7_bl1r1t2_vaC_haR_nS As String = "f7bl1r1t2vaChaRnS"
        Public Const STYLE_f7B_bl1r1t2b1_vaC_haR_nS As String = "f7Bbl1r1t2b1vaChaRnS"
        Public Const STYLE_f7_bl1r1t2b1_vaC_haR_nS As String = "f7bl1r1t2b1vaChaRnS"
        Public Const STYLE_f7_bl1r1b1_vaC_haR_nS As String = "f7bl1r1b1vaChaRnS"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haR_nS As String = "f7Bbl1r1t1b1vaChaRnS"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haR_nS As String = "f7bl1r1t1b1vaChaRnS"
        Public Const STYLE_f7U_bl1r1t1b1_vaC_haL_n As String = "f7Ubl1r1t1b1vaChaL"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haC_n As String = "f7Ibl1r1t1b1vaChaC"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haL_nS As String = "f7bl1r1t1b1vaChaLnS"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haC_nS As String = "f7bl1r1t1b1vaChaCnS"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haR_n As String = "f7Ibl1r1t1b1vaChaR"
        Public Const STYLE_f7_bl1r1t2b1_vaC_haC_nN As String = "f7bl1r1t2b1vaChaCnN"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haC_nN As String = "f7bl1r1t1b1vaChaCnN"
        Public Const STYLE_f7B_bl1r1t2b2_vaC_haL_nS As String = "f7Bbl1r1t2b2vaChaLnS"
        Public Const STYLE_f7_bl1r1t2b2_vaC_haC_nS As String = "f7bl1r1t2b2vaChaCnS"
        Public Const STYLE_f7B_bl1r1t2b2_vaC_haR_nS As String = "f7Bbl1r1t2b2vaChaRnS"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haL_nS As String = "f7Bbl1r1t1b1vaChaLnS"
        Public Const STYLE_f12B_bN_vaC_haR_nS As String = "f12BbNvaChaRnS"
        Public Const STYLE_f12_bN_vaC_haC_nS As String = "f12bNvaChaCnS"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haL_nS As String = "f7Ibl1r1t1b1vaChaLnS"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haC_nN As String = "f7Ibl1r1t1b1vaChaCnN"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haC As String = "f7BvaChaC" 'STYLE_f7B_bl1r1t1b1_vaC_haC_n ' "f7Bbl1r1t1b1vaChaC"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haL As String = "f7BvaChaL" '"f7Bbl1r1t1b1vaChaL"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haL As String = "f7vaChaL" '"f7bl1r1t1b1vaChaL"
        Public Const STYLE_f7_bl1r1t1b1_vaT_haLW As String = "f7vaThaLW" '"f7bl1r1t1b1vaChaL"
    #End Region

    Трудно поверить, но этот кусок кода написан живым человеком. И, что самое странное, этот человек считал, что использовать такие константы очень удобно.

    iley, 31 Августа 2009

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

    +152

    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
    #include <stdio.h>
    
    
    void main()
    {
    printf("WTF? :)\n");
    }
    
    #undef main
    
    
    int HAHA()
    {
    I();
    return 0;
    }

    как же написать программу с
    void main();
    ????
    gcc ./main.cpp -Dmain=I -DHAHA=main -lstdc++

    P.S. страуструп продолжает рвать на себе волосы от использования Cpp

    guest, 14 Марта 2009

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

    +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
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    EXAMPLE
    
    To specify what kind of authorization is needed to execute the program /usr/bin/pk-example-frobnicate as another user, simply write an action definition file like this
    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE policyconfig PUBLIC
      "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
      "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
    <policyconfig>
    
      <vendor>Examples for the PolicyKit Project</vendor>
      <vendor_url>http://hal.freedesktop.org/docs/PolicyKit/</vendor_url>
    
      <action id="org.freedesktop.policykit.example.pkexec.run-frobnicate">
        <description>Run the PolicyKit example program Frobnicate</description>
        <description xml:lang="da">Kør PolicyKit eksemplet Frobnicate</description>
        <message>Authentication is required to run the PolicyKit example program Frobnicate (user=$(user), program=$(program), command_line=$(command_line))</message>
        <message xml:lang="da">Autorisering er påkrævet for at afvikle PolicyKit eksemplet Frobnicate (user=$(user), program=$(program), command_line=$(command_line))</message>
        <icon_name>audio-x-generic</icon_name>
        <defaults>
          <allow_any>no</allow_any>
          <allow_inactive>no</allow_inactive>
          <allow_active>auth_self_keep</allow_active>
        </defaults>
        <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/pk-example-frobnicate</annotate>
      </action>
    
    </policyconfig>

    Simply write an action definition file like this, they said...

    bormand, 17 Декабря 2021

    Комментарии (66)
  7. Си / Говнокод #27541

    0

    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
    /* https://fstarlang.github.io/lowstar/html/Introduction.html#the-essence-of-low
    
    Consider the following very simple program:
    
    module Intro
    
    module P = LowStar.Printf
    module C = LowStar.Comment
    module B = LowStar.Buffer
    
    open FStar.HyperStack.ST
    open LowStar.BufferOps
    
    let main (): St Int32.t =
      push_frame ();
      let b: B.buffer UInt32.t = B.alloca 0ul 8ul in
      b.(0ul) <- 255ul;
      C.comment "Calls to printf are desugared via meta-programming";
      let s = "from Low*!" in
      P.(printf "Hello from %s\nbuffer contents: %xul\n"
        s 8ul b done);
      pop_frame ();
      0l
    
    ....
    
    Once compiled by the KreMLin compiler, we obtain the following C code:
    */
    
    int32_t main()
    {
      uint32_t b[8U] = { 0U };
      b[0U] = (uint32_t)255U;
      /* Calls to printf are desugared via meta-programming */
      Prims_string s = "from Low*!";
      LowStar_Printf_print_string("Hello from ");
      LowStar_Printf_print_string(s);
      LowStar_Printf_print_string("\nbuffer contents: ");
      LowStar_Printf_print_lmbuffer_u32((uint32_t)8U, (uint32_t *)b);
      LowStar_Printf_print_string("\n");
      return (int32_t)0;
    }

    Какая-то компилируемая в сишку хренотень с завтипами, разрабатываемая в Microsoft Research

    j123123, 29 Июля 2021

    Комментарии (66)
  8. JavaScript / Говнокод #27414

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    function main() {    
        const x = 21;
        let s = "foo";
        const r = `a${x * 2}X${s}X${s}Z`;
        print(r);
    }

    Продолжаем будни говно-писания говно-компилятора на LLVM. серия - а ваш говно-компилятор может так...

    и результат работы
    >>
    C:\temp\MLIR_to_exe>out.exe
    a42XfooXfooZ

    ASD_77, 10 Мая 2021

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

    +3

    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
    template<typename T>
    struct [[nodiscard]] InplacePointerGuard {
        InplacePointerGuard(T *& ptr_) : ptr(ptr_) {}
        ~InplacePointerGuard()
        {
            if (ptr != nullptr) {
                ptr->~T();
            }
        }
    
        T *& ptr;
    };
    
    template<typename EventType, typename... Args>
    bool publishEmplace(Args &&... args) const
    {
        static_assert((std::is_base_of_v<Event, EventType> && std::is_convertible_v<const EventType *, const Event *>),
                      "EventType must be a public subtype of Event");
        auto typeIdx = Event::getStaticIndex<EventType>();
    
        std::aligned_storage_t<sizeof(EventType), alignof(EventType)> eventStorage;
        EventType *eventConstructed = nullptr;
        auto guard = InplacePointerGuard(eventConstructed);
    
        publishEmplaceImpl<EventType>(typeIdx, eventStorage, eventConstructed, std::forward<Args>(args)...);
    
        return eventConstructed != nullptr;
    }
    
    template<typename EventType, typename... Args>
    static EventType *constructEvent(std::aligned_storage_t<sizeof(EventType), alignof(EventType)> & eventStorage,
                                     Args &&... args)
    {
        return std::launder(new(&eventStorage) EventType(std::forward<Args>(args)...));
    }
    
    template<typename EventType, typename... Args>
    void publishEmplaceImpl(const std::type_index & typeIdx,
                            std::aligned_storage_t<sizeof(EventType), alignof(EventType)> & eventStorage,
                            EventType *& eventConstructed,
                            Args &&... args) const
    {
        if (auto it = callbacks.find(typeIdx); it != callbacks.end()) {
            for (const auto & [subId, callback] : it->second) {
                if (!eventConstructed) {
                    eventConstructed = constructEvent<EventType>(eventStorage, std::forward<Args>(args)...);
                }
                callback(*eventConstructed);
            }
        }
    
        auto range = EventsRelation::RelationManager::getParentsRange(typeIdx);
        for (auto it = range.first; it != range.second; ++it) {
            if (!eventConstructed) {
                publishEmplaceImpl<EventType>(it->second, eventStorage, eventConstructed, std::forward<Args>(args)...);
            } else {
                publishImpl(it->second, *eventConstructed);
            }
        }
    }

    PolinaAksenova, 22 Марта 2021

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

    0

    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
    #include <iostream>
    #include <ctime>
    #include <cstdlib>
    #include <conio.h>
    const int x_size(20), y_size(10); int x_pos(x_size/2+1); int y_pos(y_size/2+1);
    enum border_types{lineNL, single, singleNL};
    enum directions{UpLeft=1, UpRight, DownLeft, DownRight}dir;
    void draw_border(enum border_types borders) {
    	do{
    		if(borders == single || borders == singleNL) break;
    		for(int i=0; i<x_size+1; i++)
    	  	  putchar('#');
    	}while(false);
    	putchar('#');
    	if(borders == singleNL || borders == lineNL) std::cout << '\n';}
    void display_update() {
    	system("cls");
    	draw_border(lineNL);
    	for(int i=1; i<=y_size; i++)
    	{
    		draw_border(single);
    		for(int j=1; j<=x_size; j++)
    		{
    			if(j == x_pos && i == y_pos)
    			{
    				putchar('x');
    				continue;
    			}
    			putchar(32);
    		}
    		draw_border(singleNL);;
    	}
    	draw_border(lineNL);
    	std::cout << "X: " << x_pos << "\tY: " << y_pos;}
    void logic() {
    	switch(x_pos)
    	{
    		case 1:
    			if(dir == UpLeft) dir = UpRight;
    			if(dir == DownLeft) dir = DownRight;
    			break;
    		case x_size:
    			if(dir == UpRight) dir = UpLeft;
    			if(dir == DownRight) dir = DownLeft;
    	}
    	switch(y_pos)
    	{
    		case 1:
    			if(dir == UpLeft) dir = DownLeft;
    			if(dir == UpRight) dir = DownRight;
    			break;
    		case y_size:
    			if(dir == DownLeft) dir = UpLeft;
    			if(dir == DownRight) dir = UpRight;
    	}}
    void move() {
    	switch(dir)
    	{
    		case UpLeft:
    			x_pos--;
    			y_pos--;
    			break;
    		case UpRight:
    			x_pos++;
    			y_pos--;
    			break;
    		case DownLeft:
    			x_pos--;
    			y_pos++;
    			break;
    		case DownRight:
    			x_pos++;
    			y_pos++;
    	}}
    int main() {
    	srand(time(0));
    	rand();
    	switch(rand()%4+1)
    	{
    		case UpLeft:
    			dir = UpLeft;
    			break;
    		case UpRight:
    			dir = UpRight;
    			break;
    		case DownLeft:
    			dir = DownLeft;
    			break;
    		case DownRight:
    			dir = DownRight;
    	}
    	while(!kbhit())
    	{
    		display_update();
    		logic();
    		move();
    	}
    	return 0;}

    Сорян, пришлось уплотнить фигурные скобки, чтобы код уместился в 100 строк.

    BelCodeMonkey, 18 Сентября 2020

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

    0

    1. 1
    https://www.facebook.com/FBE/videos/258830962097696/UzpfSTExNzQ4ODY0MjI6ODAzNDE1NzEwMDYyMjcw/

    MAKAKA, 04 Июня 2020

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