1. JavaScript / Говнокод #24544

    −1

    1. 1
    Долго не мог понять что за фреймворк такой "Vanilla JS".

    guestinxo, 26 Июля 2018

    Комментарии (6)
  2. Python / Говнокод #24543

    −1

    1. 1
    https://stackoverflow.com/questions/51521158/in-python-why-does-0xbin-return-false

    Свежий обосрамс питона

    syoma, 26 Июля 2018

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

    +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
    // Non-constant constant-expressions in C++
    // http://b.atch.se/posts/non-constant-constant-expressions/
    // The Implementation
    
    constexpr int flag (int);
    
    template<class Tag>
    struct writer {
      friend constexpr int flag (Tag) {
        return 0;
      }
    };
    
    template<bool B, class Tag = int>
    struct dependent_writer : writer<Tag> { };
    
    template<
      bool B = noexcept (flag (0)),
      int    =   sizeof (dependent_writer<B>)
    >
    constexpr int f () {
      return B;
    }
    
    int main () {
      constexpr int a = f ();
      constexpr int b = f ();
    
      static_assert (a != b, "fail");
    }

    Note: clang incorrectly shows the wrong behavior, a workaround is available in the appendix.

    j123123, 26 Июля 2018

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

    −1

    1. 1
    2. 2
    Давайте ругать "Windows"
    https://habr.com/post/418087/

    Syoma, это кокраз то, о чем ты писал: https://habr.com/post/418087/#comment_18916563

    guestinxo, 25 Июля 2018

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    #include <stdio.h>
    
    int main(void) {
        int a, b;
        int *p = &a;
        int *q = &b + 1;
        printf("%p %p %d\n", (void *)p, (void *)q, p == q);
        return 0;
    }

    https://habr.com/company/pvs-studio/blog/418023/

    0x7fff4a35b19c 0x7fff4a35b19c 0

    кто понимает почему?

    guestinxo, 25 Июля 2018

    Комментарии (34)
  6. Куча / Говнокод #24538

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    IT Оффтоп #7
     
    #1: http://govnokod.ru/18142
    #2: http://govnokod.ru/18378
    #3: http://govnokod.ru/19667
    #4: http://govnokod.ru/21160
    #5: http://govnokod.ru/21772
    #6: http://govnokod.ru/24063

    syoma, 25 Июля 2018

    Комментарии (824)
  7. JavaScript / Говнокод #24537

    −1

    1. 1
    Почему "getElementById", а не "getElementByID"?

    KOHTPArEHTTBOEuMAMKu, 24 Июля 2018

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

    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
    #-*-coding:utf8;-*-
    
    combinators = {
       'I': lambda x: x if len(x) <= 1 else calc(x[1:]),
       'K': lambda x: x if len(x) <= 2 else calc((x[1],) + x[3:]),
       'W': lambda x: x if len(x) <= 2 else calc(x[1:3] + x[2:]),
       'S': lambda x: x if len(x) <= 3 else calc((x[1], x[3], (x[2], x[3])) + x[4:]),
       'B': lambda x: x if len(x) <= 3 else calc((x[1], (x[2], x[3])) + x[4:]),
       'C': lambda x: x if len(x) <= 3 else calc((x[1], x[3], x[2]) + x[4:]),
       'U': lambda x: x if len(x) <= 2 else calc((x[2], (x[1], x[1], x[2])) + x[3:]),
       'Y': lambda x: x if len(x) <= 1 else calc(('S',('K',('S','I','I')),('S',('S',('K','S'),'K'),('K',('S','I','I')))) + x[2:])
    }
    
    def calc(x):
        def f(x, top = False):
            if type(x) is not tuple or len(x) == 0:
                return x
            if top:
                while type(x[0]) is tuple:
                    x = x[0] + x[1:]
            else:
                if type(x[0]) is tuple:
                    return (calc(x[0]),) + f(x[1:])
            print(termrepr(x))
            input('Press Enter...')
            return combinators.get(x[0], lambda _: (x[0],) + f(x[1:]))(x)
    
        return f(x, True)
    
    def parse(s):
        def f(s, n):
            res = ()
            i = n
            while i < len(s):
                if s[i] == '(':
                    t, j = f(s, i + 1)
                    res += (t,)
                    i = j - 1
                elif s[i] == ')':
                    return (res, i + 1)
                else:
                    res += (s[i],)
                i += 1
            return (res, i)
            
        return f(s, 0)[0]
    
    def termrepr(x):
        if len(x) == 0:
            return ''
        if type(x[0]) is tuple:
            return '(' + termrepr(x[0]) + ')' + termrepr(x[1:])
        else:
            return x[0] + termrepr(x[1:])
    
    print('>> ', end = '')
    while True:
        print(termrepr(calc(parse(input()))))
        print('\n>> ', end = '')

    Я перепесал #24129:

    >> BUGURT
    BUGURT
    Press Enter...
    U(GU)RT
    Press Enter...
    R((GU)(GU)R)T
    Press Enter...
    GU(GU)R
    Press Enter...
    U(GU)R
    Press Enter...
    R((GU)(GU)R)
    Press Enter...
    GU(GU)R
    Press Enter...
    U(GU)R
    Press Enter...

    666_N33D135, 24 Июля 2018

    Комментарии (12)
  9. Lua / Говнокод #24534

    −4

    1. 1
    https://pikabu.ru/story/moy_kuzen_byil_gospitalizirovan_posle_togo_kak_zasunul_sebe_v_anus_28_malenkikh_loshadok_6045256

    Potap, 23 Июля 2018

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

    −2

    1. 1
    2. 2
    А что если конпелятору переносить комментарии в ассемблерный код?
    Это относится к швабодке?

    OlegUP, 23 Июля 2018

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