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

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

    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
    string json = "{" +
                  "\"path\": " + EscapeForJson(path) + "," +
                  "\"cmd\": " + EscapeForJson(cmd) + "," +
                  "\"config\": {" +
                  "\"defaultPerms\": " + defaultPerms.ToString() + ", " +
                  "\"defaultCompPerms\": " + defaultCompPerms.ToString() + ", " +
                  "\"rules\": [";
    foreach (var rule in rules)
    {
        json += "{" +
                "\"path\": " + EscapeForJson(rule.path) + "," +
                "\"perms\": " + rule.perms.ToString() +
                "},";
    }
    
    if (rules.Length != 0)
    {
        json = json.Remove(json.Length - 1);  // remove last ','
    }
    json += "]}}";

    gost, 24 Ноября 2018

    Комментарии (38)
  3. Куча / Говнокод #24719

    +1

    1. 1
    -


    #
    ## #### #### ##### ######
    # # # # # # # #
    # # #### # # #####
    # ### # # ##### #
    # ### # # # # # # #
    ##### ### #### #### # # #


    # # ###### ##### # ###### # #### ## ##### # #### # #
    # # # # # # # # # # # # # # # # ## #
    # # ##### # # # ##### # # # # # # # # # # #
    # # # ##### # # # # ###### # # # # # # #
    # # # # # # # # # # # # # # # # # ##
    ## ###### # # # # # #### # # # # #### # #


    ###### ##### ##### #### #####
    # # # # # # # # #
    ##### # # # # # # # #
    # ##### ##### # # #####
    # # # # # # # # #
    ###### # # # # #### # #

    Konardyan, 05 Сентября 2018

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

    +3

    1. 1
    Почему Application стал так часто падать???

    А ещё csrf eггог-и nocTo9lHHo

    kir_rik, 29 Августа 2018

    Комментарии (38)
  5. Java / Говнокод #24342

    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
    package figury;
    import java.util.Scanner;
    public class figuremn {
    
    public static void main (String[] args){
    String [] monthyear = new String[12];
    monthyear [1] = "Январь";
    monthyear [2] = "Февраль";
    monthyear [3] = "Март";
    monthyear [4] = "Апрель";
    monthyear [5] = "май";
    monthyear [6] = "июнь";
    monthyear [7] = "июль";
    monthyear [8] = "август";
    monthyear [9] = "сентябрь";
    monthyear [10] = "октябрь";
    monthyear [11] = "ноябрь";
    monthyear [12] = "декабрь";
    System.out.println("Введите номер месяца");
    Scanner scan = new Scanner(System.in);
    String x = scan.nextLine;
    monthyear[]=x;
    {System.out.println(x);
    }
      }
    }

    Ray_Mints, 31 Мая 2018

    Комментарии (38)
  6. Си / Говнокод #23246

    +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
    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
    #include <stddef.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    char *concat(char *a, char *b)
    {
      char *ptr = malloc(strlen(a)+strlen(b)+6);
      if (ptr == NULL)
      {
        fprintf(stderr, "da ty ohuel!\n");
        exit(-1);
      }
      sprintf(ptr, "(%s)*(%s)", a, b);
      return ptr;
    }
    
    char *govno[255] = {"a"};
    
    void printfshit(const size_t pow, const char *mul_stuff)
    {
      printf("double pow_%zu(double a) {return %s;}\n\n", pow, mul_stuff);
    }
    
    void genshit(void)
    {
      //printfshit(0,"1");
      size_t end_ind = 1;
      size_t prev_stop = 0;
      size_t end_ind_tmp = 1;
      while (end_ind < 255)
      {
        for (size_t ind1 = 0; ind1 < end_ind_tmp; ind1++)
        {
          for (size_t ind2 = prev_stop; ind2 < end_ind_tmp; ind2++)
          {
            if ( 
                 ((ind1+1) + (ind2+1) < 256) &&
                 (govno[(ind1+1) + (ind2+1)-1] == NULL)
               )
            {
              govno[(ind1+1) + (ind2+1)-1] = concat(govno[ind1], govno[ind2]);
              end_ind++;
            }
          }
        }
        prev_stop = end_ind_tmp;
        end_ind_tmp = end_ind;
      }
      printfshit(1,govno[0]);
      for (size_t i = 1; i < 255; i++ )
      {
        printfshit(i+1,govno[i]);
        free(govno[i]);
      }
    }
    
    int main(void)
    {
      genshit();
      return 0;
    }

    Кодогенератор, написаный специально для Antervis
    http://govnokod.ru/23227#comment388895

    j123123, 08 Августа 2017

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

    +1

    1. 1
    2. 2
    3. 3
    CoolIntf::GetInstance().DoSomething();
    CoolIntf::GetInstance().DoSomethingElse();
    CoolIntf::GetInstance().DoAnything()

    для случая когда GetInstance() не инлайнится, кто-нибудь в крестах какое решение (без ручного введения временной переменной) для такого кода придумал?
    единственное что нашел это вот это: https://stackoverflow.com/a/2279253 .
    потому что "with" слишком общее слово которое в ж не гуглится.

    Dummy00001, 04 Августа 2017

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

    +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
    29. 29
    #include <iostream>
    #include <stdexcept>
    
    using namespace std;
    
    class Exception : std::runtime_error
    {
    public:
        Exception( std::string const & what ) : std::runtime_error(what)
        {
        }
    };
    
    int main( )
    {
        try
        {
            throw Exception("Exception");
        }
        catch ( std::exception const & e )
        {
            std::cerr << e.what() << std::endl;
        }
        catch(...)
        {
            std::cerr << "..." << std::endl;
        }
        return 0;
    }

    laMer007, 08 Июля 2016

    Комментарии (38)
  9. Куча / Говнокод #20128

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    //Сегодня у меня вопрос по говнокоду.
    //Как у нас на говнокодике реализовано сколько непросмотренных комментариев в каждом треде?
    //Неужели на каждого юзера заводится счётчик и инкрементится при добавлении в каждой теме?
    //Неужели на каждого юзера на каждый комментарий заводится флаг, сообщающий какой комментарий прочитан, а какой нет?

    LispGovno, 03 Июня 2016

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

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    template<typename T>
    T gcd(T a, T b) {
    #pragma python(gcd)
        while b != 0:
            a, b = b, a % b
        return a
    }

    всех с праздником, посоны
    http://codeforces.com/blog/entry/44124

    3_dar, 01 Апреля 2016

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

    +8

    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
    template <size_t capacity, bool is_signed>
    class fixed_int
    {	
        // Описание ошибки компиляции в случае использования не поддерживаемой размерности 
        template <int x> struct unsupported_capacity { int i[1/(x-x)]; };
        template <> struct unsupported_capacity<1> {};
        template <> struct unsupported_capacity<2> {};
        template <> struct unsupported_capacity<4> {};
        template <> struct unsupported_capacity<8> {};
    
        // Свойства базовых типов, необходимые для перебора
        template<typename type> struct type_traits;
        template<> struct type_traits <unsigned char> { typedef unsigned char current_type; typedef unsigned short next_type; };
        template<> struct type_traits <unsigned short> { typedef unsigned short current_type; typedef unsigned int next_type; };
        template<> struct type_traits <unsigned int> { typedef unsigned int current_type; typedef unsigned long next_type; };
        template<> struct type_traits <unsigned long> {	typedef unsigned long current_type; typedef unsigned long long next_type; };
        template<> struct type_traits <unsigned long long int> { typedef unsigned long long int current_type;  typedef unsupported_capacity<capacity> next_type; };
        template<> struct type_traits <signed char> { typedef signed char current_type; typedef short next_type; };
        template<> struct type_traits <short> { typedef short current_type; typedef int next_type; };
        template<> struct type_traits <int> { typedef int current_type; typedef long next_type; };
        template<> struct type_traits <long> { typedef long current_type; typedef long long next_type; };
        template<> struct type_traits <long long int> { typedef long long int current_type;  typedef unsupported_capacity<capacity> next_type;};
    
        // Алгоритм выбора типа
        template<typename type, bool> 
        struct type_choice 
        { 
            typedef typename type_traits<type>::current_type std_type; 
        };
        template<typename type> 
        struct type_choice<type, false> 
        { 
            typedef typename type_traits<type>::next_type next_type; 
            typedef typename type_choice<next_type, sizeof(next_type) == capacity>::std_type std_type; 
        };
    
        // Базовый тип для начала подбора
        template <bool is_signed> struct base_type_selector { typedef signed char base_type; };
        template <> struct base_type_selector<false> { typedef unsigned char base_type; };
    
    public:
    
        typedef typename type_choice< typename base_type_selector<is_signed>::base_type, sizeof(base_type_selector<is_signed>::base_type) == capacity >::std_type type;
    
    };

    "Зачем мне нужен stdint.h?
    У меня нет времени, чтобы ебаться с ним!
    Лучше я высру ещё десяток-другой шаблонов!"
    https://habrahabr.ru/post/280542/

    PS,
    Пятая строка - вообще угар.

    gost, 31 Марта 2016

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