1. Куча / Говнокод #24580

    −1

    1. 1
    2. 2
    "Java", "Python" и "C/C++" - говно.
    Факт.

    HighVoltageDick, 04 Августа 2018

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

    +2

    1. 1
    https://s22.postimg.cc/5zky9jn1t/Image_from_i_OS.jpg

    roskomgovno, 03 Августа 2018

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

    0

    1. 1
    https://habr.com/post/419141/

    LinuxGovno, 03 Августа 2018

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

    −3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    #include <iostream>
    using namespace std;
    
    void wtf() {
     return 0;
    }
    int main() {
     return wtf();
     cout << wtf();
    }

    Решил нопейсать ватафак-код.
    Классика жанра. Ретурн в воидовской функции. Плюс действие после ретурна.

    shite, 03 Августа 2018

    Комментарии (47)
  5. C# / Говнокод #24573

    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
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.RegularExpressions;
    
    
    /* The "Enter le ..." thing
    is left for Шindows compilers.
    Don't mind it. */
     namespace SoloLearn
     {
         public class Program
         {
             public static void Main(string[] args)
             {
                 int a = 0;
                 int b = 0; //Declare two numbers
                 string leChar; //Declare the character
                 int sum; //Declare the place where the result of the expression would be stored
                 Console.WriteLine("Enter le first number\n");
                 string c = a.ToString(); //Convert the 1st № to string
                 c = Console.ReadLine(); //Assign the 1st number
                 Console.WriteLine("Enter le character\n");
                 leChar = Console.ReadLine(); //Assign the char
                 Console.WriteLine("Enter le second number\n");
                 string d = b.ToString(); //Convert the 2nd № to string
                 d = Console.ReadLine(); //Assign the second number
                 a = System.Convert.ToInt16(c);
                 b = System.Convert.ToInt16(d);
                 sum = Calculate(a,leChar,b); //Calculate
                 Console.WriteLine("{0} {1} {2} is {3}", a, leChar, b, sum);
             }
             public static int Calculate(int x, string z, int y) {
                 int qwerty = 0;
                 switch(z) {
                     case "+": //Case of addition
                     qwerty = x + y;
                     break;
                     case "-": //Case of subtraction
                     qwerty = x - y;
                     break;
                     case "*": //Case of multiplication
                     qwerty = x * y;
                     break;
                     case "/": //Case of division
                     qwerty = x / y;
                     break;
                 }
                 return qwerty; //If smth = Calculate(parameters), var smth would have the content of this var © Your Captain Obvious
             }
         }
     }

    Выдавил из себя где-то месЕц назад. Как я умудрялся делать 2 переменные для просто стринговых версий существующих переменных только для того, чтобы прочитать инпут? Хорошо, что в сисярпе есть гарбаж коллектор. И да, названия переменных во второй функции - прекрасные (посмотрите: x, y, z, qwerty - не прекрасно ли?) говГо.

    shite, 03 Августа 2018

    Комментарии (12)
  6. JavaScript / Говнокод #24572

    0

    1. 1
    2. 2
    3. 3
    https://javascript.ru/forum/events/74655-peredacha-parametrov-v-funkciyu.html
    https://javascript.ru/forum/events/74576-mozhno-li-ispolzovat-funkciyu-odnogo-diva-v-drugom.html
    https://javascript.ru/forum/events/74553-kalkulyaciya-ceny-na-sajjte.html

    roskomgovno, 02 Августа 2018

    Комментарии (24)
  7. PHP / Говнокод #24570

    −7

    1. 1
    За "PHP"!

    LinuxGovno, 02 Августа 2018

    Комментарии (10)
  8. PHP / Говнокод #24568

    −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
    <ul class="news-list">
    
        <?php
    global $news_list_toc;
    foreach ($news_list_toc as $i => $d) {
        echo <<<NI_ITEM
        <li class="news-list-item">
            <div class="news-list-item-date">
                {$d['date']}
            </div>
            <div class="news-list-item-title">
                <a href="?fetch=news&with=the&id={$i}">{$d['title']}</a>
            </div>
        </li>
    NI_ITEM;
    
        } ?>
    
    </ul>

    Нашел при рефакторинге своего проекта. Чем, чем я думал, когда писал это? У нормальных людей такого органа кажется и нету...

    Показывать на собеседованиях с вопросом "что вам нравится в этом коде?"

    Arris, 02 Августа 2018

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

    0

    1. 1
    https://www.youtube.com/watch?v=UcO6OXVZGyI

    Можно промотать в конец.

    OlegUP, 02 Августа 2018

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

    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
    #include <iostream>
    #include <memory>
    #include <thread>
    #include <chrono>
    #include <mutex>
     
    struct Base
    {
        Base() { std::cout << "  Base::Base()\n"; }
        // Note: non-virtual destructor is OK here
        ~Base() { std::cout << "  Base::~Base()\n"; }
    };
     
    struct Derived: public Base
    {
        Derived() { std::cout << "  Derived::Derived()\n"; }
        ~Derived() { std::cout << "  Derived::~Derived()\n"; }
    };
     
    void thr(std::shared_ptr<Base> p)
    {
        std::this_thread::sleep_for(std::chrono::seconds(1));
        std::shared_ptr<Base> lp = p; // thread-safe, even though the
                                      // shared use_count is incremented
        {
            static std::mutex io_mutex;
            std::lock_guard<std::mutex> lk(io_mutex);
            std::cout << "local pointer in a thread:\n"
                      << "  lp.get() = " << lp.get()
                      << ", lp.use_count() = " << lp.use_count() << '\n';
        }
    }
     
    int main()
    {
        std::shared_ptr<Base> p = std::make_shared<Derived>();
     
        std::cout << "Created a shared Derived (as a pointer to Base)\n"
                  << "  p.get() = " << p.get()
                  << ", p.use_count() = " << p.use_count() << '\n';
        std::thread t1(thr, p), t2(thr, p), t3(thr, p);
        p.reset(); // release ownership from main
        std::cout << "Shared ownership between 3 threads and released\n"
                  << "ownership from main:\n"
                  << "  p.get() = " << p.get()
                  << ", p.use_count() = " << p.use_count() << '\n';
        t1.join(); t2.join(); t3.join();
        std::cout << "All threads completed, the last one deleted Derived\n";
    }

    https://en.cppreference.com/w/cpp/memory/shared_ptr

    Объясните почему "reset" не грохнул инстанс в других потоках?

    guestinxo, 02 Августа 2018

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