1. Assembler / Говнокод #27205

    −6

    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
    includelib  C:\Irvine\User32.Lib
    includelib  C:\Irvine\Kernel32.Lib
    includelib  D:\masm32\lib\Irvine32.lib
    include     \masm32\include\Irvine32.inc
    
    ; D:/masm32/bin/ml.exe /c  /coff  "D:\asm\rcl.asm"
    ; D:/masm32\bin\link.exe /subsystem:console  "D:\asm\rcl.obj"
    
    .data
    
      
    .code
    main PROC
      xor eax, eax
      xor edx , edx
      
      mov al , 10101010b
      
      cmp al,80h
      jns just
      shr al,1
      jmp print
      
      just:
     
      shr al,1
      or ax,80h
     
      print:
      call WriteBin
    		
    	exit
    	main ENDP
    END main

    Дай бог здоровья товарищу Ирвину.

    Madhouse_camomile, 10 Января 2021

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

    −3

    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 hlp_fix(char data[]  , char dump_alpha[] ){
    int run = 0;
    char prev = '0';
    int count_bracket = 0 ;
    puts(dump_alpha);
    	
    if(my_isdigit(data[0]) || my_isalpha(data[0])    ){
    					 prev = data[0];
    					}
    	else if (data[0] == '('){
    			count_bracket++;
    			 prev = data[0];
    	}
     			else{
    				  
    					puts("!!!  first error  !!!");
    				  	exit(1);
    				  }
    
    for(run = 1;data[run] != '\0' ;run++){
    	
    	
    	if ( data[run + 1]    == '\0'  &&  isOperator(prev )           ){
    					
    					puts("!!! error  isOperator  !!!");
    				  	exit(1);
    			}
    
    	
    	if(isgraph(data[run] )){
    		
    		if( secure_1(data[run], dump_alpha )  ) { 
    		  printf("!!! error  this no list = %c !!!",  data[run] );
    			exit(1);
    		}
    		
    		if(prev == '.' ){
    			
    			if( data[run  - 1 ]   == '.' && my_isdigit(data[run])      )   {
    						 prev = data[run];
    				}
    		
    		 else{
    				  	
    					puts(" !!! error point !!!");
    				  	exit(1);
    				  }
    			}
    		
    			else	if(my_isdigit(prev)  ){
    				
    			
    			if(  data[run] == ')' )   {
    					 	 prev = data[run];
    					 	--count_bracket;
    					 }
    				
    			else	if(	 (	my_isdigit(data[ run - 1  ])       	||	data[run - 1 ] == '.' || 
    					
    					isOperator(data[run]) )    ){
    					 prev = data[run];
    					
    			}
    					 
    			else{
    				  puts("error  isdigit");
    				  	exit(1);
    				  }
    				}
    		
    			else	if(isOperator(prev)){
    			
    				if( (my_isdigit(data[run])  || my_isalpha(data[run] )       )   ){
    						 prev = data[run];
    				}
    					else if ( data[run] == '('  ){
    							 prev = data[run];
    							 count_bracket++;
    					}
    					
    			else{
    				  	
    					puts("error  isOperator");
    				  	exit(1);
    				  }
    				}
    			
    			else	if(prev == '(' ){
    			
    				if( (my_isdigit(data[run] )  || my_isalpha(data[run] )  ) ){
    					 prev = data[run];
    				
    				}
    				else if ( data[run] == '('){
    					 count_bracket++;
    					 prev = data[run];
    				}
    				
    				
    				else{

    Ни что так не вдохновляет на бейсджампинг без парашюта как "отлов ошибок" который не работает ))))
    https://ideone.com/rjrwMQ

    Oh-my-God-my-leg, 07 Января 2021

    Комментарии (2)
  3. Java / Говнокод #27197

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    This would raise the true nightmare. A type variable is a different beast than the actual type of a concrete instance. 
    A type variable could resolve to a, e.g. ? extends Comparator<? super Number> to name one (rather simple) example. 
    Providing the necessary meta information would imply that not only object allocation becomes much more expensive, 
    every single method invocation could impose these additional cost, to an even bigger extend as we are now not only 
    talking about the combination of generic classes with actual classes, but also every possible wildcarded combination, 
    even of nested generic types.

    https://stackoverflow.com/a/38060012

    Джавист-долбоеб с пеной у рта защищает type erasure, задавая вопросы "Does it [c#] have an equivalent of Function.identity()? " в комментариях и собирая плюсы таких же поехавших.
    В качестве аргументов он предлагает:

    1) сложна
    2) хранить информацию о типах в рантайме означает что в рантайме придется хранить информацию о типах!!!
    3) [s]ма-те-ма-ти-ка[/x] реф-лек-си-я

    Причем ведь наверняка знает и про темплейты в крестах, и про то что шарп такой хуйней не страдает.

    Fike, 05 Января 2021

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

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    #include <string>
    #include <iostream>
     
    int main() {
        std::string kakoi("Какой багор )))", 5);
        std::string bagor((std::string)"Какой багор )))" , 5);
        std::cout << kakoi << bagor << std::endl; 
    }

    Наверняка было, но ладно.

    https://ideone.com/syFnI2

    3_dar, 04 Января 2021

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

    +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
    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
    board = [" ", " ", " "], \
            [" ", " ", " "], \
            [" ", " ", " "]
    
    i = 1
    win = True
    place_chek = True
    
    
    def show():
        print("---------")
        print("|" + board[0][0] + "  " + board[0][1] + "  " + board[0][2] + "|")
        print("|" + board[1][0] + "  " + board[1][1] + "  " + board[1][2] + "|")
        print("|" + board[2][0] + "  " + board[2][1] + "  " + board[2][2] + "|")
        print("---------")
    
    
    def move(i):
        if i % 2 == 0:
            return "X"
        else:
            return "0"
    
    
    def choise(x, y):
        board[x][y] = move(i)
    
    
    def repeat(x, y):
        global i
        global place_chek
        if board[x][y] == "0":
            print()
            print("Choose another location")
            print()
            place_chek = False
    
        elif board[x][y] == "X":
            print()
            print("Choose another location")
            print()
            place_chek = False
    
        elif board[x][y] == " ":
            i = i + 1
            place_chek = True
    
    
    def win_check():
        global win
        if board[0][0] == board[0][1] == board[0][2] == "X" or \
                board[1][0] == board[1][1] == board[1][2] == "X" or \
                board[2][0] == board[2][1] == board[2][2] == "X" or \
                board[0][0] == board[1][0] == board[2][0] == "X" or \
                board[0][1] == board[1][1] == board[2][1] == "X" or \
                board[0][2] == board[1][2] == board[2][2] == "X" or \
                board[0][0] == board[1][1] == board[2][2] == "X" or \
                board[0][2] == board[1][1] == board[2][0] == "X":
            print("X won")
            win = False
    
        elif board[0][0] == board[0][1] == board[0][2] == "0" or \
                board[1][0] == board[1][1] == board[1][2] == "0" or \
                board[2][0] == board[2][1] == board[2][2] == "0" or \
                board[0][0] == board[1][0] == board[2][0] == "0" or \
                board[0][1] == board[1][1] == board[2][1] == "0" or \
                board[0][2] == board[1][2] == board[2][2] == "0" or \
                board[0][0] == board[1][1] == board[2][2] == "0" or \
                board[0][2] == board[1][1] == board[2][0] == "0":
            print("0 won")
            win = False
    
    
    show()  # first time show
    
    while win:
        x, y = input("Enter the coordinates: ").split()
        repeat(int(x) - 1, int(y) - 1)
        if place_chek:
            choise(int(x) - 1, int(y) - 1)
        show()
        win_check()

    Крестики нолики на питоне. Самый большой позор это способ определение победы, не смог ничего придумать и сделал такой позор

    warzon131, 03 Января 2021

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

    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
    void s_sort(int *a, size_t sz)
    {
      if ((sz == 0) || (sz == 1))
      {
        return;
      }
      if (sz  == 2)
      {
        int a_max = a[0] > a[1] ? a[0] : a[1];
        int a_min = a[0] > a[1] ? a[1] : a[0];
        a[0] = a_min;
        a[1] = a_max;
        return;
      }
      s_sort(a, sz - 1);
      s_sort(a + 1, sz - 1);
      s_sort(a, sz - 1);
    }

    Крайне тупая по своей сути рекурсивная сортировка. Есть ли у нее название?

    Вряд ли она имеет какое-то практическое применение именно как сортировка, но зато можно ее переписать на какой-нибудь Coq и об нее доказывать другие сортировки. Типа если какая-то там другая сортировка на всех возможных входных массивах выдает то же, что и выдает вот эта сортировка, то сортировка правильная.

    j123123, 03 Января 2021

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

    −2

    1. 1
    We’ve heard your feedback that you want Visual Basic on .NET Core

    https://devblogs.microsoft.com/vbteam/visual-basic-support-planned-for-net-5-0/

    MAKAKA, 31 Декабря 2020

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

    +3

    1. 1
    Новогодний оффтоп #1

    Перекатить через год.

    gostinho, 31 Декабря 2020

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

    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
    99. 99
    #include <iostream>
    using namespace std;
    const char _Arr_Digit [] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'},
        _Arr_Mantissa [] = {'e', 'E'},
        _Arr_Sign [] = {'-', '+'},
        _Arr_Dot[] = {'.'},
        _Arr_Combo[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.'};
    const bool DIGIT = false, SIGN = false, OTHER = true;  
    bool _Call_Mantissa = false,  _flag_dot = false, _flag_mant = false;
    int _position_mant;
    bool Parse_symbol (char _symb, const char* _Arr, int _size_arr);
    bool Parse_full_string (string _checking, int _offset, int _amount, bool _sec_cond, const char* _Arr, int _size_arr, bool _Drive);   
    bool Parse_the_first_symbol (string _checking);
    bool Parse_the_second_symbol (string _checking);
    bool Control_result (int i, string _checking);
    bool Parse_mantissa (string _checking);
    bool Parse_full_string_before_mantissa (int i, string _checking);
    bool Parse_the_first_symbol_after_mantissa (string _checking);
    bool Parse_full_string_after_mantissa (string _checking);
    long double Questioning (char s);
    long double Questioning (char s) {
        string _checking;
        while (true) {  
            cout << "Введите значение " << s << ": ";
            getline(cin, _checking);  
            if (_checking.length() == 0) 
                cout << "Вы не ввели значение!" << endl;   
            else if (!Parse_the_first_symbol(_checking)) 
                cout << "Некорректное значение!" << endl;  
            else return strtold(_checking.c_str(), nullptr); }}
    bool Parse_symbol (char _symb, const char* _Arr, int _size_arr) {
        for (int i = 0; i <= _size_arr; i++)  
            if (_symb == _Arr[i]) return true;
        return false; }
    bool Parse_full_string (string _checking, int _offset, int _amount, bool _sec_cond, const char* _Arr, int _size_arr, bool _Drive) {  
        bool _parse_flag;
        int _parse_count = 0;
        for (int j = _offset; j < _amount; j++) {
            if (Parse_symbol(_checking[j], _Arr, _size_arr)) {
                _parse_count++;
                if (_sec_cond) return false;
                if (_Drive) {
                    if (_Call_Mantissa)
                        _sec_cond = (j == (_amount-1));
                    if (_parse_flag) return false;
                    _parse_flag = true;
                    if (_Call_Mantissa) {
                        _flag_mant = _parse_flag;
                        _position_mant = j; 
                    }
                }
            }
        }
       if (!_Drive) { 
           if ((_amount - _offset) == _parse_count) return true;
           else return false; 
        }
       else return true; 
    }
    bool Parse_the_first_symbol (string _checking) {
      int LENGTH = _checking.length();
      bool _parse_cond = (LENGTH < 2);
      if (Parse_full_string (_checking, 0, 1, _parse_cond, _Arr_Sign, 1, SIGN)) 
          return Parse_the_second_symbol (_checking);
      else if (Parse_full_string (_checking, 0, 1, false, _Arr_Digit, 9, DIGIT))
          return Control_result (0, _checking);
      else return false; }
    bool Parse_the_second_symbol (string _checking) {
        if (Parse_full_string (_checking, 1, 2, false, _Arr_Digit, 9, DIGIT)) 
            return Control_result (1, _checking);
        else return false; }
    bool Control_result (int i, string _checking) {    
        if (!Parse_mantissa (_checking)) return false;    
        else if (_flag_mant) {
            string _before_mantissa = _checking.substr(0, _position_mant);
            string _after_mantissa = _checking.substr(_position_mant + 1);
            return (Parse_full_string_before_mantissa (i, _before_mantissa)
                    && Parse_the_first_symbol_after_mantissa (_after_mantissa)); } 
        else return Parse_full_string_before_mantissa (i, _checking); }
    bool Parse_mantissa (string _checking) {
        int LENGTH = _checking.length();
        _Call_Mantissa = true;   
        bool cash = Parse_full_string (_checking, 0, LENGTH, false, _Arr_Mantissa, 1, OTHER);
        _Call_Mantissa = false;
        return cash; }
    bool Parse_full_string_before_mantissa (int i, string _checking) { // but the first symbol  
        int LENGTH = _checking.length();
        return Parse_full_string (_checking, i, LENGTH, false, _Arr_Dot, 0, OTHER) &&
            Parse_full_string (_checking, i, LENGTH, false, _Arr_Combo, 10, DIGIT); }
    bool Parse_the_first_symbol_after_mantissa (string _checking) {
        int LENGTH = _checking.length();
        bool _parse_cond = (LENGTH < 2);
        if ((Parse_full_string (_checking, 0, 1, _parse_cond, _Arr_Sign, 1, SIGN)) ||
            (Parse_full_string (_checking, 0, 1, false, _Arr_Digit, 9, DIGIT)))
            return Parse_full_string_after_mantissa (_checking);
        else return false; }
    bool Parse_full_string_after_mantissa (string _checking) {
        int LENGTH = _checking.length();
        return Parse_full_string (_checking, 1, LENGTH, false, _Arr_Digit, 9, DIGIT); }

    Очередная говнопопытка оптимизации алгоритма.

    Westnik_Govnokoda, 30 Декабря 2020

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

    +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
    chek_LD(void)
    {
    	LOCK_DETECT = read();
    	if (LOCK_DETECT == SAVE_LOCK_DETECT)
    	{
    		return;
    	}
    	if (LOCK_DETECT == 0)
    	{
    		LOCK_DETECT = read();
    		if (LOCK_DETECT == 0)
    		{
    			if (LOCK_DETECT != SAVE_LOCK_DETECT)
    			{
    				SAVE_LOCK_DETECT = 0;
    			}
    		}
    	}
    	else
    	{
    		delay_us(5);
    		LOCK_DETECT = read();
    		if (LOCK_DETECT == 1)
    		{
    			if (LOCK_DETECT != SAVE_LOCK_DETECT)
    			{
    				SAVE_LOCK_DETECT = 1;
    			}
    		}
    	}
    	return;
    }

    пришел на легаси проект. обожаю глобальные переменные на весь проект. еще больше обожаю логику)

    viteo, 29 Декабря 2020

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