1. C++ / Говнокод #14173

    +13

    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
    auto write =    [&buf](future<int> size) -> future<bool>    { 
      return streamW.write(size.get(), buf).then(
        [](future<int> op){
          return op.get() > 0; });    };   
    auto flse = [](future<int> op){
     return future::make_ready_future(false);};  auto copy = do_while(
        [&buf]() -> future<bool>    {
         return streamR.read(512, buf)    .then(
           [](future<int> op){ return (op.get() > 0) ? write : flse;});    });  
    
    ///////////////////////////////////////////////////////////////////////////
    
    int cnt = 0;   
    do  {  
    cnt = await streamR.read(512, buf);   
    if ( cnt == 0 ) break;   
    cnt = await streamW.write(cnt, buf);   
    } while (cnt > 0);

    Первое и второе угадайте что? Правильно, С++. В компиляторе студии и первое и второе будет. Первое уже даже есть. Ни первое ни второе не приняли в стандарт на сколько мне известно и надеюсь лобисты Майкрософт во главе с Саттером пойдут на ... подальше от крестов.

    www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3722.pdf

    LispGovno, 03 Декабря 2013

    Комментарии (33)
  2. C++ / Говнокод #14172

    +8

    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
    void print(int i) {printf("int: %d\n", i);}
    void print(double f) {printf("double: %f\n", f);}
    void print(char const * c) {printf("str: %s\n", c);}
    
    void WTF(...) {}
    
    template<typename... T>
    void print(T ... t) 
    {
      WTF((print(t), 0)...);
    }
    
    int main()
    {
      print(1, "hello", 3.0);
      return 0;
    }

    http://ideone.com/wddRC7

    LispGovno, 03 Декабря 2013

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

    +124

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    S consume (S) (ref S data, Regex ! ( Unqual!(typeof(S.init[0])) ) rg)
    {
        writeln (typeid(Unqual!(typeof(S.init[0]))));
    
        auto m = match(data, rg);
        return m.hit;
    }

    LispGovno, 03 Декабря 2013

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

    +14

    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
    Node<maxCnt>   n[sizeY][sizeX], on;
    //...
    auto EachConvex = [](auto f, Body& b) 
    {
      for (auto g : b.g)
      {
        auto cp = Body::ConvexPtr(&b, g);
        auto bounds = cp.bounds();
        auto max = Rect(0, 0, sizeX - 1, sizeY - 1);
        auto out = max.intersect(bounds);
        auto b = max & bounds;
        for (auto x = b.left; x < b.right; ++i)
          for (auto y = b.top; x < b.bottom; ++i)
            f(n[y][x], cp);
        if (out)
          f(on, cp);      
      }
      return true;
    }

    LispGovno, 03 Декабря 2013

    Комментарии (15)
  5. PHP / Говнокод #14169

    +147

    1. 1
    2. 2
    3. 3
    4. 4
    $_where = array();
    $_where[] = "`activity` = 'active'";
    $_where[] = "`counter_of_waiting_questions` = '0'";
    $_where = implode(' AND ', $_where);

    g0rky, 03 Декабря 2013

    Комментарии (6)
  6. Pascal / Говнокод #14168

    +76

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    procedure TForm1.FormCreate(Sender: TObject);
    begin
    SetCurrentDir(ExtractFileDir(Application.ExeName)); 
    try
    ADOConnection1.Connected:=true;
    if ADOConnection1.Connected=true then
    begin
      ADOTable1.Active:=True;
    end;
    except
      MessageDLG('Îøèáêà ïîäêëþ÷åíèÿ ÁÄ',mtError,[mbOk],0);
    end;

    SetCurrentDir(ExtractFileDir(Application .ExeName));
    Не знаю, откуда ты, но знаю, куда тебе дальше.

    Stertor, 03 Декабря 2013

    Комментарии (250)
  7. Java / Говнокод #14167

    +69

    1. 1
    2. 2
    3. 3
    4. 4
    if (errors.isEmpty())
                success(result);
            else
                throw new UnsupportedOperationException();

    ошибки быть не может!

    Dougrinch, 03 Декабря 2013

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

    −131

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Процедура ОбработкаЗаполения(Основание)
    
    	// Другой говнокод
    
    КонецПроцедуры

    Стажёр подошёл с вопросом, почему не обрабатывается ввод на основании, а до этого бился не менее часа.

    Voittamaton, 03 Декабря 2013

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

    +130

    1. 1
    class Int extends Float {}

    http://haxe.ru/ref-base_types

    someone, 02 Декабря 2013

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

    +129

    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
    [Serializable]
     private class NameValue<N, V>
     {
          public N Name { get; set; }
          public V Value { get; set; }
          public NameValue() { }
          public NameValue(N name, V value)
          {
              Name = name;
              Value = value;
          }
     }
    
     private System.Collections.Generic.List<NameValue<string, string>> productList =
                new System.Collections.Generic.List<NameValue<string, string>>();

    не шутка

    taburetka, 02 Декабря 2013

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