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

    +77

    1. 1
    float tlen = sqrtf(top[0]*top[0]+top[1]*top[1]+top[2]*top[2]);

    Всё в мире тлен и безысходность. В том числе и код.

    Sauron, 10 Августа 2013

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

    +15

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    union AtomicIndx
    {
      struct { std::atomic<uint16> ReadCur, ReadMax, WriteCur, WriteMax; };
      struct { struct Idx { uint16 Cur, Max; }; std::atomic<Idx> Read, Write; };
      struct { struct Idx { uint16 ReadCur, ReadMax, WriteCur, WriteMax; }; std::atomic<Idx> All; };
    };
    static_assert(sizeof(AtomicIndx) == sizeof(uint64), "sizeof(AtomicIndx) != sizeof(uint64)");

    Мы все знаем откуда это.

    LispGovno, 08 Августа 2013

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

    +20

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    template<class T> 
    void FuncSmth(T value) 
    { 
      if(typeid(T) == typeid(int)) 
          FuncInt(value); 
      else if(typeid(T) == typeid(char*)) 
          FuncCharPtr(value); 
    }

    Оттуда

    falsting, 06 Августа 2013

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

    +21

    1. 1
    typedef void *(*internalPointer) (const std::map<std::string, std::pair<const void*  volatile* const, void* const *> > (*FuncPointer)(volatile const int&, const char *const, const void *const *const (*FuncArg)(const std::vector<std::string>&)), void * const *, volatile int&, int * (*FuncArg2) (const std::string&, const std::vector<void>*) );

    thereisnosun, 06 Августа 2013

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

    +12

    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
    if  ( (_gen_statP==tm_Manual)  ||
                              (_gen_statP==tm_OK)          && (_cur_statP!=tm_Manual)  ||
                              (_gen_statP==tm_ValidTM)     && (_cur_statP!=tm_Manual)  &&  (_cur_statP!=tm_OK) ||
                              (_gen_statP==tm_Rejected)    && (_cur_statP!=tm_Manual)  &&  (_cur_statP!=tm_OK) && (_cur_statP!=tm_ValidTM) ||
                              (_gen_statP==tm_Bad)         && (_cur_statP!=tm_Manual)  &&  (_cur_statP!=tm_OK) && (_cur_statP!=tm_ValidTM) && (_cur_statP!=tm_Rejected) ||
                              (_gen_statP==tm_Statistic)   && (_cur_statP!=tm_Manual)  &&  (_cur_statP!=tm_OK) && (_cur_statP!=tm_ValidTM) && (_cur_statP!=tm_Rejected)  && (_cur_statP!=tm_Bad)
                            ) {
                                _cur_statP = _gen_statP;
                              }
    
    
                        if  ( (_gen_statQ==tm_Manual)  ||
                              (_gen_statQ==tm_OK)          && (_cur_statQ!=tm_Manual) ||
                              (_gen_statQ==tm_ValidTM)     && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) ||
                              (_gen_statQ==tm_Rejected)    && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) && (_cur_statQ!=tm_ValidTM) ||
                              (_gen_statQ==tm_Bad)         && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) && (_cur_statQ!=tm_ValidTM) && (_cur_statQ!=tm_Rejected) ||
                              (_gen_statQ==tm_Statistic)   && (_cur_statQ!=tm_Manual) && (_cur_statQ!=tm_OK) && (_cur_statQ!=tm_ValidTM) && (_cur_statQ!=tm_Rejected)  && (_cur_statQ!=tm_Bad)
                            ) {
                                _cur_statQ = _gen_statQ;
                              }

    Вроде работает, но уж больно некрасиво) по идее вычисляет новый статус в соответствии с "приоритетом"

    mapron, 06 Августа 2013

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

    +12

    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
    void FileCreate(const char *name)
    {
    	ofstream F;
    	F.open(name); // Create file 
    	F.close(); //close the file
    }
    
    void InputProduct(Product &b) //function for entering product
    {
    	char c; int i=0;
    
    	cout<<"Input name of product \n"; 
    	// enter the string until you meet the character \n or EOF or until a limit is the number of symbols
    	for ( i=0; i<l_name && (c = getchar())!= EOF && c!='\n';++i ) 
    		b.name[i] = c ; 
    	b.name[i]='\0'; // at the end of the line write the terminating line \0
    
        // rest of code ...
    }

    Студенты такие студенты ...

    denis90, 03 Августа 2013

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

    +4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    case WM_SIZE:
    			for(i=0;i<6;i++)
    			{
    				if(RegNotifyChangeKeyValue(hTopKeys[i],TRUE,REG_NOTIFY_CHANGE_NAME|REG_NOTIFY_CHANGE_ATTRIBUTES|
    					REG_NOTIFY_CHANGE_LAST_SET|REG_NOTIFY_CHANGE_SECURITY,NULL,FALSE)==ERROR_SUCCESS)
    				{
    					MessageBox(NULL,"1","1",MB_OK);
    				}
    			}

    http://forum.shelek.ru/index.php/topic,14613.0.html

    Обратите внимание, товарищи, что у лица, создавшего сей шедевр, статус - "Опытный". Вот так и живем.

    Stertor, 30 Июля 2013

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

    +19

    1. 1
    }while(1  <--  index);

    LispGovno, 30 Июля 2013

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

    +21

    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
    if (Utility::compareVersions(myVersionStr, latestVersionStr) < 0)
    {
        // New version is available. Download and install the new version.
        performUpdate();
    }		
    else
    {
        bool isUpdateRunning = Utility::isUpdateRunning();
    				
        if (!isUpdateRunning)
        {
            performUpdate();
        }
    }

    Нашел в коде после того как у тестера версия 1.0.0.401 обновилась на 1.0.0.395

    letheriem, 29 Июля 2013

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

    +15

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    public:
        std::string GetDescriptionString() const 
        {
            std::stringstream strStream;
            strStream << std::string(mErrorDescription);
            return strStream.str();
        }
    
    private:
        //! Error description
        std::string mErrorDescription;

    Как вернуть std::string?

    letheriem, 29 Июля 2013

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