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

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

    +4

    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
    int main()
    {
        using ToString::ExprToString;
    
        using Result1 = Eval<Expr<Add,
            Expr<Div, Int<5>, Int<3>>,
            Expr<Div, Int<6>, Int<8>>>>;
        std::cout << ExprToString<Result1>::toString() << std::endl;  // 5/3 + 6/8 = (29 / 12)
    
        using Result2 = Eval<Expr<Div, Int<100>, Int<20>>>;
        std::cout << ExprToString<Result2>::toString() << std::endl;  // 5
    
        using Result3 = Eval<Expr<Div, Int<27>, Int<24>>>;
        std::cout << ExprToString<Result3>::toString() << std::endl;  // (9 / 8)
    
        using Result4 = Eval<Expr<Mul,
            Expr<Div, Int<5>, Int<3>>,
            Expr<Div, Int<6>, Int<8>>>>;
        std::cout << ExprToString<Result4>::toString() << std::endl;  // 5/3 * 6/8 = (5 / 4)
    
        using Result5 = Eval<Expr<Derivative, Var<0>, Expr<Mul, Var<0>, Var<0>>>>;
        std::cout << ExprToString<Result5>::toString() << std::endl;  // d/dx x*x = 2*x = (Var(0) * 2)
    
        using Result6 = Eval<Expr<Derivative, Var<0>, Expr<Div, Int<2>, Var<0>>>>;
        std::cout << ExprToString<Result6>::toString() << std::endl;  // d/dx 2/x = -2 * x^2
    
        return EXIT_SUCCESS;
    }

    Написал калькулятор с символьными вычислениями на шаблонах. Получился «Лисп».
    https://wandbox.org/permlink/vAHC5IpyIIyQhUjJ

    gost, 04 Января 2020

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

    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
    #include <iostream>
    #include <functional>
    #include <array>
    
    template<typename F, int... I>
    std::array<int, sizeof...(I)> materializeImpl(const F & f, std::integer_sequence<int, I...>)
    {
        return { (f(), I)... };
    }
    
    template<size_t N, typename F, typename I = std::make_integer_sequence<int, N>>
    auto materialize(const F & f)
    {
        return materializeImpl(f, I{});
    }
    
    template<size_t N, typename F>
    void times(const F & f)
    {
        (void)materialize<N>([&f]() { f(); return 0; });
    }
    
    int main()
    {
        times<22>([]() { std::cout << "Hello There." << std::endl; });
        return EXIT_SUCCESS;
    }

    Наш инженерный отдел ебанулся на отличненько!
    https://wandbox.org/permlink/txNcEa2ZkuG2A1Sj

    gost, 19 Декабря 2019

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

    +1

    1. 1
    https://www.youtube.com/watch?v=WT-oowiPUVQ

    Черная дыра

    cmepmop, 18 Сентября 2019

    Комментарии (16)
  5. PHP / Говнокод #25763

    0

    1. 1
    2. 2
    list($msec, $sec) = explode(chr(32), microtime()); // время запуска скрипта
    $conf['headtime'] = $sec + $msec;

    Stallman, 12 Августа 2019

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public class class inheritance mein (kampf) {
        int **her_na_polke = cidiez_alloc(sizeof(int) * SIZE);
    
        // suka blyat ebany ci diez
    
        ...
    
        // here is garbage collector, so... nothing do
    }

    _________

    Ksyrx, 29 Июля 2019

    Комментарии (16)
  7. Куча / Говнокод #25666

    +3

    1. 1
    Infinity = 1 bsl 64,

    Не говнокод, но просто смешно

    CHayT, 07 Июня 2019

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

    −102

    1. 1
    Гниль

    Всё - гниль.

    AHCKujlbHblu_netyx, 05 Июня 2019

    Комментарии (16)
  9. Си / Говнокод #25440

    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
    // https://patents.google.com/patent/US20160357533A1/en
    // Generating code in statically typed programming languages for dynamically typed array-based language 
    /*
    Example 2
    
    The cell array is classified as heterogeneous and translated into a C structure. Source code includes the following array, which is classified as belonging to a heterogeneous class.
    	
    x = {‘add’, d1, ‘multiply’, d2, ‘add’, 1, ‘add’, 1};
    ...
    function y = process (x)
     ...
     y = 0;
     for i = 1:2:numel(x)
      if ~strcmp(x{i}, ‘add’)
       y = y + x{i+ 1};
      elseif ~strcmp(x{i}, ‘multiply’)
       y = y * x{i+1};
      end
     end
    end
    
    C code generated in the STPL contains a C structure type that is used for the variable “x”:
    */
    typedef struct {
        char f1[3];
        double f2;
        char f3[8];
        double f4;
        char f5[3];
        double f6;
        char f7[3];
        double f8;
      } cell_0;
    static double process(const cell_0 x)
    {
      ...
    }

    Сраные софтерные патенты. Блядь, вдумайтесь в эту хуйню. Вам дан динамически-типизированный язык, вот типа есть такой "массив" в котором элементы могут быть произвольной поеботой, например строками, флоатами. Как нам это оттранслировать? Да запросто, вот допустим есть такое говно: x = {‘add’, d1, ‘multiply’, d2, ‘add’, 1, ‘add’, 1}; - хуйнуть структуру надо
    typedef struct {
      char f1[3]; // тут сука 3 буквы потому что слово "add" из трех букв
      double f2;
      char f3[8]; // тут сука 8 букв потому что слово "multiply" из 8 букв
      double f4;
      char f5[3]; // тут сука 3 буквы потому что слово "add" из трех букв
      double f6;
      char f7[3]; // тут сука 3 буквы потому что слово "add" из трех букв
      double f8;
    } cell_0;

    А нахуй? Ну т.е. вот потом там будет сгенерен в сишке код, который будет через memcmp проверять этот char f1[3] что там "add", и потом будет еще код, который проверит что char f3[8] это "multiply", да? Ну т.е. у вас структура специализирована под конкретную поебень x = {‘add’, d1, ‘multiply’, d2, ‘add’, 1, ‘add’, 1}; и там блядь и так понятно, что вот там будет add, там будет multiply, и что вот такое количество элементов, это ясно из самого определения структуры, нахуй это говно вообще? И это говно еще запатентовали

    j123123, 10 Марта 2019

    Комментарии (16)
  10. Си / Говнокод #25289

    +1

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    int etm_readl_cp14(u32 reg, unsigned int *val)
    {
    	switch (reg) {
    	case ETMCR:
    		*val = etm_read(ETMCR);
    		return 0;
    	case ETMCCR:
    		*val = etm_read(ETMCCR);
    		return 0;
    	case ETMTRIGGER:
    		*val = etm_read(ETMTRIGGER);
    		return 0;
    	case ETMSR:
    		*val = etm_read(ETMSR);
    		return 0;
    	case ETMSCR:
    		*val = etm_read(ETMSCR);
    		return 0;
    	case ETMTSSCR:
    		*val = etm_read(ETMTSSCR);
    		return 0;
    	case ETMTEEVR:
    		*val = etm_read(ETMTEEVR);
    		return 0;
    	case ETMTECR1:
    		*val = etm_read(ETMTECR1);
    		return 0;
    	case ETMFFLR:
    		*val = etm_read(ETMFFLR);
    		return 0;
    	case ETMACVRn(0):
    		*val = etm_read(ETMACVR0);
    		return 0;
    	case ETMACVRn(1):
    		*val = etm_read(ETMACVR1);
    		return 0;
    	case ETMACVRn(2):
    		*val = etm_read(ETMACVR2);
    		return 0;
    	case ETMACVRn(3):
    		*val = etm_read(ETMACVR3);
    		return 0;
    	case ETMACVRn(4):
    		*val = etm_read(ETMACVR4);
    		return 0;
    	case ETMACVRn(5):
    		*val = etm_read(ETMACVR5);
    		return 0;
    	case ETMACVRn(6):
    		*val = etm_read(ETMACVR6);
    		return 0;
    	case ETMACVRn(7):
    		*val = etm_read(ETMACVR7);
    		return 0;
    	case ETMACVRn(8):
    		*val = etm_read(ETMACVR8);
    		return 0;
    	case ETMACVRn(9):
    		*val = etm_read(ETMACVR9);
    		return 0;
    	case ETMACVRn(10):
    		*val = etm_read(ETMACVR10);
    		return 0;
    	case ETMACVRn(11):
    		*val = etm_read(ETMACVR11);
    		return 0;
    	case ETMACVRn(12):
    		*val = etm_read(ETMACVR12);
    		return 0;
    	case ETMACVRn(13):
    		*val = etm_read(ETMACVR13);
    		return 0;
    	case ETMACVRn(14):
    		*val = etm_read(ETMACVR14);
    		return 0;
    	case ETMACVRn(15):
    		*val = etm_read(ETMACVR15);
    		return 0;
    	case ETMACTRn(0):
    		*val = etm_read(ETMACTR0);
    		return 0;
    	case ETMACTRn(1):
    		*val = etm_read(ETMACTR1);
    		return 0;
    	case ETMACTRn(2):
    		*val = etm_read(ETMACTR2);
    		return 0;
    	case ETMACTRn(3):
    		*val = etm_read(ETMACTR3);
    		return 0;
    	case ETMACTRn(4):
    		*val = etm_read(ETMACTR4);
    		return 0;
    	case ETMACTRn(5):
    		*val = etm_read(ETMACTR5);
    		return 0;
    	case ETMACTRn(6):
    		*val = etm_read(ETMACTR6);
    		return 0;
    	...

    Вроде и да, а вроде и нет

    Ksyrx, 06 Января 2019

    Комментарии (16)
  11. Python / Говнокод #24866

    −12

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    #Было:
    sorted(lst, key=lambda x: x['key'])
    #или
    sorted(lst, key=operator.itemgetter('key')
    
    #стало:
    sorted(lst, key=S_['key'])

    Говнокоданы, как вам такая идея?

    syoma, 07 Октября 2018

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