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

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

    −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
    #include <stdio.h>
    #include <stdlib.h>
    #include <inttypes.h>
    
    int main(void)
    {
      char a[8], b[8];
      char *a_ptr = a+8;
      char *b_ptr = b;
      printf("a_ptr = %p, b_ptr = %p\n", a_ptr, b_ptr);
      if (a_ptr != b_ptr)
      {
        printf("a_ptr != b_ptr\n");
      }
      else
      {
        printf("a_ptr == b_ptr\n");
      }
      
      
      if ((uintptr_t)a_ptr != (uintptr_t)b_ptr)
      {
        printf("(uintptr_t)a_ptr != (uintptr_t)b_ptr\n");
      }
      else
      {
        printf("(uintptr_t)a_ptr == (uintptr_t)b_ptr\n");
      }
      return EXIT_SUCCESS;
    }

    Что по-вашему тут происходит?

    j123123, 02 Февраля 2019

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

    +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
    // https://www.tutorialspoint.com/Read-a-character-from-standard-input-without-waiting-for-a-newline-in-Cplusplus
    
    
    
    // A portable solution doesn't exist for doing this. On windows, you can use the getch() function from the conio(Console I/O) library to get characters pressed. For example,
    
    #include<iostream>
    #include<conio.h>
    using namespace std;
    int main() {
        char c;
        while(1){ // infinite loop
            c = getch();
            cout << c;
        }
    }
    
    // This will output whatever character you input to the terminal. Note that this will only work on windows as the conio library exists only on windows. On UNIX, you can achieve this by entering in system raw mode. For example,
    
    #include<iostream>
    #include<stdio.h>
    int main() {
        char c;
       // Set the terminal to raw mode
        system("stty raw");
        while(1) {
            c = getchar(); 
            // terminate when "." is pressed
            if(c == '.') {
                system("stty cooked");
                exit(0);
            }  
            std::cout << c << " was pressed."<< std::endl;
        }
    }

    Вариант под UNIX еще и очень секурный, ЕВПОЧЯ

    j123123, 22 Января 2019

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    Как перенести секцию ресурсов из одного филе в другое? Не корысти ради. Я - преемник робин-гуда.
    Я не вор - я всего лишь нищий аристократ.
    
    Ну да-да, заебали, вирь пишу.

    Примерчик на пасцале, плз. Других языков я уже не знаю.

    Goh, 28 Ноября 2018

    Комментарии (39)
  5. Куча / Говнокод #25105

    0

    1. 1
    2. 2
    3. 3
    4. 4
    Нашёл смешной репозиторий у чувака из майкрософта, который
    там делает помершелл грейт эгейн.
    
    https://github.com/bitcrazed/badcase

    vistefan, 21 Ноября 2018

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    #include <stdio.h>
    
    int main(void) {
        puts("\x05pituh");
        puts("\x06COCOCO");
        puts("\x0000000005CO-CO");
        puts("\00256");
        return 0;
    }

    https://ideone.com/qNn7NF

    Ололо, а я-то сразу и не понял в чём дело...

    adrnin, 27 Октября 2018

    Комментарии (39)
  7. Objective C / Говнокод #24721

    +1

    1. 1
    2. 2
    3. 3
    https://pbs.twimg.com/media/Dl4x_P-XsAAPfgC.jpg
    
    https://twitter.com/_inside/status/1035319938641276928 The Apple Watch pride face is hardcoded to not show up if the paired iPhone is using the Russian locale

    > Однако 30 октября 2014 года в статье на Bloomberg Businessweek Кук совершил каминг-аут, признавшись в своей гомосексуальности, и выразил надежду, что это признание поможет другим геям принять себя и вдохновит их на борьбу за свои права.

    Бабло победило принципы

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

    Комментарии (39)
  8. Swift / Говнокод #24489

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    type file;
    
    app (file o) simulation ()
    {
      simulate stdout=filename(o);
    }
    
    foreach i in [0:9] {
      file f <single_file_mapper; file=strcat("output/sim_",i,".out")>;
      f = simulation();
    }

    Более другой swift

    Desktop, 13 Июля 2018

    Комментарии (39)
  9. Python / Говнокод #24294

    0

    1. 1
    2. 2
    3. 3
    4. 4
    try:
            assert isinstance(tag, bs4.element.Tag)
        except AssertionError:
            raise TypeError

    syoma, 20 Мая 2018

    Комментарии (39)
  10. Python / Говнокод #24129

    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
    def calc ( x ) :
        if type ( x ) is not list :
            return x
        if len ( x ) == 0 :
            return x
        while type ( x [ 0 ] ) is list :
            x = x [ 0 ] + x [ 1: ]
        c = x [ 0 ]
        print ( x )
        if c == 'I' :
            if len ( x ) <= 1 :
                return x
            return calc ( x [ 1: ] )
        elif c == 'K' :
            if len ( x ) <= 2 :
                return x
            return calc ( [ x[1] ] + x [ 3: ] )
        elif c == 'W' :
            if len ( x ) <= 2 :
                return x
            return calc ( x[1:3] + x[ 2: ] )
        elif c == 'S' :
            if len ( x ) <= 3 :
                return x
            return calc ( [ x[1] , x [3] , [ x[2] , x[3] ] ] + x [ 4: ] )
        elif c == 'B' :
            if len ( x ) <= 3 :
                return x
            return calc ( [ x[1] , [ x[2] , x[3] ] ] + x[4:] )
        elif c == 'C' :
            if len ( x ) <= 3 :
                return x
            return calc ( [ x[1] , x[3] , x[2] ] + x[ 4 : ] )
        return [ c ] + calc ( x [ 1: ] )
    
    
    def parse ( s , n = 0 ) :
      res = []
      i = n
      while i < len ( s ) :
        if s [ i ] == '(' :
          t = parse ( s , i + 1 )
          res.append ( t [ 0 ] )
          i = t [ 1 ] - 1
        elif s [ i ] == ')' :
          return ( res , i + 1 )
        else :
          res.append ( s [ i ] )
        i += 1
      return ( res , i )
    
    print ( '>> ' , end = '' )
    while True :
        for i in calc ( parse ( input() ) [ 0 ] ) :
            print ( i , end = '' )
        print ( '\n>> ' , end = '' )

    Вычисляэ комбинаторныэ термы, и выдаё промежности, типа:

    >> S(SKK)(SKK)x
    ['S', ['S', 'K', 'K'], ['S', 'K', 'K'], 'x']
    ['S', 'K', 'K', 'x', [['S', 'K', 'K'], 'x']]
    ['K', 'x', ['K', 'x'], [['S', 'K', 'K'], 'x']]
    ['x', [['S', 'K', 'K'], 'x']]
    ['S', 'K', 'K', 'x']
    ['K', 'x', ['K', 'x']]
    ['x']
    xx

    yet_another_one_shit, 16 Апреля 2018

    Комментарии (39)
  11. JavaScript / Говнокод #23630

    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
    function isInteger(i) {
    	if(i > ~~i == false) return false
    	alert("тест "+(i > ~~i))
    	return true
    }
    alert( isInteger(1) ) // true
    alert( isInteger(1.5) ) // false
    alert( isInteger(-0.5) ) // false
    
    //Второй вариант с багом
    function isInteger(i) {
    	if(i > ~~i) return false
    	alert("тест "+(i > ~~i))
    	return true
    }
    alert( isInteger(1) ) // true
    alert( isInteger(1.5) ) // false
    alert( isInteger(-0.5) ) // false //нихуя не фалсе

    Это пиздец нахуй, смотрите как легко налажать в js

    fuckercoder, 31 Декабря 2017

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