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

    +3.3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    class boolshit{
    public:
    boolshit(bool shit):_shit(shit){}
    operator bool() const{return _shit;}
    private:
    bool _shit;
    };

    :)

    Ror77, 13 Августа 2009

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

    +18.2

    1. 1
    2. 2
    ProfileManager* man = Application::GetProfileManager();
    		_DESIRE(man);	//гм. "Желать мужика". Ужос какой. Это не я написал, если чо. Это оно само

    Вот в коде наткнулся, улыбнуло

    ich, 13 Августа 2009

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

    +17

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    unsigned long f( unsigned long a ) {
     while( (1 << 24) < a )
      a -= (1 << 24);
     return a;
    }

    Найден в дебрях старого проекта. Цель непонятна. Предположение -- обнулить старших 8-мь бит в 32-х битовом числе.

    eao197, 13 Августа 2009

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

    +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
    //retrive the weather file
        QProcess* process = new QProcess(this);
        QString command = "wget -O " + QDir::homePath() + "/.weather.xml http://weather.yahooapis.com/forecastrss?p=" + zip;
    
        if(tempType == "C")
        {
           command.append("&u=c");
        }
        
        process->start(command);
        process->waitForFinished();
        delete process;

    Учитесь писать переносимый код!

    Sauron, 12 Августа 2009

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

    +13

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    __inline BOOL IsNumeric(LPTSTR lpsBuf)
    {
     int i, nSize = _tcslen(lpsBuf);
     for (i = 0; i < nSize; i++)
      if ((lpsBuf[i] < _T('0')) || (lpsBuf[i] > _T('9')))
       return (FALSE);
     return (TRUE);
    }

    Серъёзный алгоритм.

    Exhumer, 12 Августа 2009

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

    +17

    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
    std::string sError = "";
    try
    {
       fIn = fopen(cszFileName, "rb");
       if (fIn == 0)
       {
         sError = "Can not open file: ";
         sError += cszFileName;
         throw std::string("");
       }
    
       if (!ParseFile(fIn, pLookup))
       {
         sError = "Bad file format. File: ";
         sError += cszFileName;
         throw std::string("");
       }
    
       sError = "";
       throw std::string("");
    }
    catch (std::string& e)
    {
       if (fIn != 0)
       {
          fclose(fIn);
          fIn = NULL;
       }
       if (sError.length() != 0)
       {
          throw std::exception(sError.c_str());
       }
    }

    Там же нашел еще более шикарное продолжение гавнокода http://govnokod.ru/1459

    lugal, 12 Августа 2009

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

    +18.3

    1. 1
    2. 2
    3. 3
    4. 4
    while(0<1)
    {
      ...
    }

    В универе встречал такой вот бесконечный цикл

    shurikroger, 12 Августа 2009

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

    +34

    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
    void dump_indexes(map<int,stride_slices> picks, ofstream &f);
    {
      f<<"# full size: "<<picks.size()<<endl;
      for(map<int, stride_slices>::iterator
    	p=picks.begin(); p!=picks.end(); ++p)
        {
          f<<"## "
           <<p->first<<"'st stride slices count: "
           <<p->second.size()<<endl;
          
          for(stride_slices::iterator
    	    pp=p->second.begin(); pp!=p->second.end(); ++pp)
    	{
    	  f<<"### "
    	   << p->first<<"'st stride, "
    	   <<pp->first<<"'st slice size: "
    	   <<pp->second.size()<<endl;
    	  for(max_slice::iterator
    		ppp=pp->second.begin(); ppp!=pp->second.end(); ++ppp)
    	    {
    	      f<<"#### "
    	       <<p->first<<"'st stride, "
    	       <<pp->first<<"'st slice, "
    	       <<ppp->first<<"'st chunk size:"
    	       <<ppp->second.size()<<endl;
    	      
    	      for(max_chunk::iterator
    		    pppp=ppp->second.begin(); pppp!=ppp->second.end(); ++pppp)
    		f<<"       "
    		 <<p->first<<" "
    		 <<pp->first<<" "
    		 <<ppp->first<<" "
    		 <<pppp->first<<" : "
    		 <<pppp->second<<endl;	
    	    }
    	}
        }
    }

    а как нормально просмотреть кучу вложенных контейнеров?

    Biburath, 11 Августа 2009

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

    +33.2

    1. 1
    cStaticObject * CreateStaticObject	( obj_id_t object_id, mesh_id_t mesh_id, material_id_t material_id, int32_t coord_x, int32_t coord_y, int32_t coord_z, int32_t angle_azimuth, int32_t angle_zenith, int32_t angle_longitudinal, uint32_t size_x, uint32_t size_y, uint32_t size_z, uint16_t flags );

    stup, 11 Августа 2009

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

    +46.3

    1. 1
    delete ptr + int(ptr=0);

    Освобождение памяти и обнуление указателя.

    k06a, 11 Августа 2009

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