1. Список говнокодов пользователя kcalbCube

    Всего: 61

  2. Си / Говнокод #28058

    +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
    #include <stdio.h>
    
    int main(void)
    {
    	(
    		*********************
    		**  **     ** ***** *
    		* ** * **** ** *** **
    		* ** * **** *** * ***
    		* ** * **** **** ****
    		* ** * **** *** * ***
    		* ** **    *** *** **
    		*********************
    	printf)("pidor");
    }

    kcalbCube, 26 Февраля 2022

    Комментарии (13)
  3. Си / Говнокод #28056

    +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
    static char *cast_table[][11] = {
      // i8   i16     i32     i64     u8     u16     u32     u64     f32     f64     f80
      {NULL,  NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i8
      {i32i8, NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i16
      {i32i8, i32i16, NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   i64f32, i64f64, i64f80}, // i64
    
      {i32i8, NULL,   NULL,   i32i64, NULL,  NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u8
      {i32i8, i32i16, NULL,   i32i64, i32u8, NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u16
      {i32i8, i32i16, NULL,   u32i64, i32u8, i32u16, NULL,   u32i64, u32f32, u32f64, u32f80}, // u32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   u64f32, u64f64, u64f80}, // u64
    
      {f32i8, f32i16, f32i32, f32i64, f32u8, f32u16, f32u32, f32u64, NULL,   f32f64, f32f80}, // f32
      {f64i8, f64i16, f64i32, f64i64, f64u8, f64u16, f64u32, f64u64, f64f32, NULL,   f64f80}, // f64
      {f80i8, f80i16, f80i32, f80i64, f80u8, f80u16, f80u32, f80u64, f80f32, f80f64, NULL},   // f80
    };

    красивое

    kcalbCube, 26 Февраля 2022

    Комментарии (2)
  4. Си / Говнокод #28055

    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
    // Takes a printf-style format string and returns a formatted string.
    char *format(char *fmt, ...) {
      char *buf;
      size_t buflen;
      FILE *out = open_memstream(&buf, &buflen);
    
      va_list ap;
      va_start(ap, fmt);
      vfprintf(out, fmt, ap);
      va_end(ap);
      fclose(out);
      return buf;
    }

    kcalbCube, 25 Февраля 2022

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

    −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
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    typedef enum {
      FILE_NONE, FILE_C, FILE_ASM, FILE_OBJ, FILE_AR, FILE_DSO,
    } FileType;
    
    StringArray include_paths;
    bool opt_fcommon = true;
    bool opt_fpic;
    
    static FileType opt_x;
    static StringArray opt_include;
    static bool opt_E;
    static bool opt_M;
    static bool opt_MD;
    static bool opt_MMD;
    static bool opt_MP;
    static bool opt_S;
    static bool opt_c;
    static bool opt_cc1;
    static bool opt_hash_hash_hash;
    static bool opt_static;
    static bool opt_shared;
    static char *opt_MF;
    static char *opt_MT;
    static char *opt_o;
    
    static StringArray ld_extra_args;
    static StringArray std_include_paths;
    
    char *base_file;
    static char *output_file;
    
    static StringArray input_paths;
    static StringArray tmpfiles;

    благо поиск по проекту работает

    kcalbCube, 25 Февраля 2022

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

    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
    void pong_game(void)
       {
          /*Set the first random direction the ball will be traviling*/
          direction=random_direction();
          
          /*Play the game while the ESC key is not pressed*/
          while(!key[KEY_ESC]) {
             /*Move the Ball*/
             move_ball();
             /*Respond to the input*/
             key_respond();
             
             /*Put the information on the Screen*/
             textout(buffer,pong_datafile[pong_text].dat,"Player 1 Score:",
                     150,0,254);
             textout(buffer,pong_datafile[pong_text].dat,itoa(score_p1,NULL,10),
                     text_length(pong_datafile[pong_text].dat,
                     "Player 1 Score:")+150,0,10);
             textout(buffer,pong_datafile[pong_text].dat,"Player 2 Score:",
                     350,0,254);
             textout(buffer,pong_datafile[pong_text].dat,itoa(score_p2,NULL,10),
                     text_length(pong_datafile[pong_text].dat,
                                 "Player 2 Score:")+350,0,10);
             textout(buffer,pong_datafile[pong_text].dat,"keyboard",0,0,255);
             textout(buffer,pong_datafile[pong_text].dat,"joystick",
                     640-text_length(pong_datafile[pong_text].dat,"joystick"),
                     0,255);
             /*Draw a line to set the boundries*/
             line(buffer,0,30,640,30,10);
             
             /*Put the buffer screen on the screen*/
             blit(buffer,screen,0,0,0,0,640,480);
             
             /*Clear the buffer*/
             clear(buffer);
          }
          return;
       }

    помните?

    kcalbCube, 20 Февраля 2022

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

    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
    #define debut     {
    #define fin       }
    #define si        if
    #define alors     {
    #define sinon     } else {
    #define sinonsi   } else if
    
    #define repeter   do {
    #define jusqua    } while (!
    
    #define choix     switch
    #define quand     case
    
    #define retourner return

    какой gaffe))

    kcalbCube, 19 Февраля 2022

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

    +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
    constexpr int add(int a, int b) 
    {
        return a + b;
    }
    
    static_assert(1 |> add(2) == and(1, 2));
    
    FILE* file = fopen( “a.txt”, “wb” );
    if (file) {
        fputs(“Hello world”, file);
        file |> fseek(9, SEEK_SET);
        file |> fclose();
    }
    
    auto dangerous_teams(std::string const& s) -> bool {
        return s
             |> views::group_by(std::equal_to{})
             |> views::transform(ranges::distance)
             |> ranges::any_of([](std::size_t s){
                    return s >= 7;
                });
    }

    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2011r0.html

    какой C++)))

    kcalbCube, 19 Февраля 2022

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

    −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
    Так в языке
    
    
    Не должно быть макросов и прочей кодогенерации, т.к. вся информация о зависимых типах должна быть доступна на этапе компиляции. 
    Вся рефлексия должна быть выполнима на этапе компиляции. Generic'и в топку...
    
    Не должно быть линковки в привычном её понимании — JIT/AOT должен уметь пересобрать с PGO любой отпрофилированный код и выбрать наилучшую реализацию по существующему профилю.
    
    Язык должен быть гомоиконным и строго типизированным (типизированные Lisp'ы 98го года и Shift, например), желательно что бы легко приводился к каноническим минимальным mSSA/aSSA формам без дополнительных трансформаций и свёртки.
    
    Во время компиляции должны быть доступны диапазоны всех принимаемых переменной значений, например http статус от 200 до 600 и т.п., что бы компилятор мог выбрать конкретную размерность типа в зависимости от архитектуры и использовать соответствующий набор команд. Наличие диапазонов очень упрощает обработку ошибок и освобождение/планировку соответствующих ресурсов (сокеты, файлы и прочее).
    
    Желательно использовать зависимые типы для формальной верификации и доказывать прувером отсутствие побочки на всех диапазонах принимаемых значений.

    какой багор))

    kcalbCube, 17 Февраля 2022

    Комментарии (7)
  10. Assembler / Говнокод #28024

    −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
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    ; %ch - x1, %cl - y1, %dh - x2, %dl - y2 ;
    drawline:
    	push %a
    	push %b
    	push %c
    	push %d
    	push %e
    	
    	mov %al %dh
    	sub %al %ch
    	call @abs
    	mov %ah %al ; ah - dX ;
    	
    	mov %al %dl
    	sub %al %cl
    	call @abs
    	neg %al ; al - -dY ;
    	
    	mov %bh FFh ; bh - signX;
    	mov %bl FFh ; bl - signY ;
    	
    	cmp %ch %dh
    	jgz @.S1
    	neg %bh
    	.S1:
    	
    	cmp %cl %dl
    	jgz @.S2
    	neg %bl
    	.S2:
    	
    	mov %el %ah
    	add %el %al ; el - error ;
    	
    	push %d
    	call @drawpixel
    	pop %d
    	 
    	.loop:
    		cmp %ch %dh
    		jnz @.L1
    		cmp %cl %dl
    		jnz @.L1
    		jmp @.loop_end
    		.L1:
    		
    		push %c
    		call @drawpixel
    		pop %c
    
    		mov %eh %el
    		
    		cmp %eh %al
    		jng @.L2
    			add %el %al
    			add %ch %bh
    		.L2: 
    		cmp %eh %ah
    		jgz @.loop
    			add %el %ah
    			add %cl %bl
    		jmp @.loop
    		
    	.loop_end:
    	
    	pop %e
    	pop %d
    	pop %c
    	pop %b
    	pop %a
    	ret

    https://pastebin.com/k8697fae

    алгоритм брезенхема.

    результат: https://imgur.com/a/c1twuNt

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

    kcalbCube, 16 Февраля 2022

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

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    знает кто как шестнадцатеричные числа в np++ подсвечивать?
    а то у меня даже вот такое
                                     v
    memset [@T1] 3A98h 0h
    не подсвечивает.
    пробовал в дополнительные символы чисел добавлять, не хочет.

    kcalbCube, 16 Февраля 2022

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