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

    −36

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //установка режима реализма
    		void includeRealTimeMode()
    		{
    			TSerialCommand^ command = gcnew TSerialCommand;
    			command->cmd = CMD_CONTROL;
    			command->sc1 = SC_REAL_TIME_MODE;
    			command->sc2 = NULL; //_portManager.oscillFrequency;
    			_portManager.sendCommand(command);
    
    		}

    Команда включает (активирует) режим реального времени.
    C++\CLI

    Говногость, 19 Июня 2012

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

    −30

    1. 1
    TTime childStartTime(TDateTime(2006, EJanuary, 8, 14, 0, 0, 0)); // January 9th 2pm

    Из примера calexample в symbian sdk.

    bormand, 19 Июня 2012

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

    −35

    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
    // For the probably_koi8_locales we have to look. the standard says
    // these are 8859-5, but almost all Russian users use KOI8-R and
    // incorrectly set $LANG to ru_RU. We'll check tolower() to see what
    // it thinks ru_RU means.
    // If you read the history, it seems that many Russians blame ISO and
    // Perestroika for the confusion.
    ...
    static QTextCodec * ru_RU_hack(const char * i) {
        QTextCodec * ru_RU_codec = 0;
    
    #if !defined(QT_NO_SETLOCALE)
        QByteArray origlocale(setlocale(LC_CTYPE, i));
    #else
        QByteArray origlocale(i);
    #endif
        // unicode   koi8r   latin5   name
        // 0x044E    0xC0    0xEE     CYRILLIC SMALL LETTER YU
        // 0x042E    0xE0    0xCE     CYRILLIC CAPITAL LETTER YU
        int latin5 = tolower(0xCE);
        int koi8r = tolower(0xE0);
        if (koi8r == 0xC0 && latin5 != 0xEE) {
            ru_RU_codec = QTextCodec::codecForName("KOI8-R");
        } else if (koi8r != 0xC0 && latin5 == 0xEE) {
            ru_RU_codec = QTextCodec::codecForName("ISO 8859-5");
        } else {
            // something else again... let's assume... *throws dice*
            ru_RU_codec = QTextCodec::codecForName("KOI8-R");
            qWarning("QTextCodec: Using KOI8-R, probe failed (%02x %02x %s)",
                      koi8r, latin5, i);
        }
    #if !defined(QT_NO_SETLOCALE)
        setlocale(LC_CTYPE, origlocale);
    #endif
    
        return ru_RU_codec;
    }

    Снова Qt. На этот раз src/corelib/codecs/qtextcodec.cpp и борьба бобра с ослом русских с буржуинскими стандартами ISO.

    bormand, 14 Июня 2012

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

    −55

    1. 1
    2. 2
    3. 3
    void f(int...)
    {
    };

    Компилится.
    http://ideone.com/yPgoq

    HaskellGovno, 13 Июня 2012

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

    −37

    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
    static QPainterPath::ElementType qpaintengineex_line_types_16[] = {
        QPainterPath::MoveToElement, QPainterPath::LineToElement,
        QPainterPath::MoveToElement, QPainterPath::LineToElement,
        QPainterPath::MoveToElement, QPainterPath::LineToElement,
        ... еще 12 строк ...
        QPainterPath::MoveToElement, QPainterPath::LineToElement
    };
    
    static QPainterPath::ElementType qpaintengineex_rect4_types_32[] = {
        QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 1
        QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 2
        ... еще 29 строк ...
        QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 31
        QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 32
    };

    Qt 4.x.x, src/gui/painting/qpaintengineex.cpp
    Как я понял, используется для ускорения функций drawLines и clip (дабы не выделять память и не заполнять path каждый раз).

    bormand, 13 Июня 2012

    Комментарии (37)
  6. C++ / Говнокод #10934

    −51

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    void a() 
    {
    }
     
    void b()
    {
      return a();
    }

    Компилится.
    http://ideone.com/8eP1w

    HaskellGovno, 13 Июня 2012

    Комментарии (53)
  7. C++ / Говнокод #10922

    −16

    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
    template <class T>
    inline T qobject_cast(const QObject *object)
    {
        // this will cause a compilation error if T is not const
        register T ptr = static_cast<T>(object);
        Q_UNUSED(ptr);
    
    #if !defined(QT_NO_MEMBER_TEMPLATES) && !defined(QT_NO_QOBJECT_CHECK)
        reinterpret_cast<T>(0)->qt_check_for_QOBJECT_macro(*reinterpret_cast<T>(const_cast<QObject *>(object)));
    #endif
        return static_cast<T>(const_cast<QObject *>(reinterpret_cast<T>(0)->staticMetaObject.cast(const_cast<QObject
     *>(object))));
    }

    Кастовали-кастовали и выкастовали!
    corelib/kernel/qobject.h в Qt 4.7.x

    bormand, 12 Июня 2012

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

    −33

    1. 1
    2. 2
    bool operator()(int x,int y)
    {return x<y;}

    Вторая часть) реально интересуются люди
    "надо два объекта моего класса сравнить, так?"
    ну, вообще жесть

    Diss, 11 Июня 2012

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

    −25

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    bool operator<(const A *obj){
    if (obj->n < this->n)
    return true;
    else if (this->n < obj->n)
    return false;
    };

    Перегрузка оператора сравнения

    Diss, 11 Июня 2012

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

    −27

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    class Screen
    {
    private:
            unsigned char *data; // do not move
            size_t size; // do not move

    USB, 09 Июня 2012

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