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

    +164

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    class Parent{
      int class_id;
      union Children{
         ClassA   classA;
         ClassB   classB;
         .....
      }
    }

    Найдено на просторах Интернета.

    Говногость, 04 Февраля 2011

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

    +164

    1. 1
    min=(pSamplesVector->operator[](i)).x;

    rat4, 04 Февраля 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    std::ostringstream s;
    for( std::list< Candidate* >::iterator it = order_by_priority.begin(); 
    		it != order_by_priority.end(); ){
    	s << (*it)->id << "/" << priorityDesc((*it)->priority());
    	it++;
    	if( it!= order_by_priority.end() )
    		s << ", ";
    }
    return s.str();

    Странное обращение с циклом for.

    panter_dsd, 04 Февраля 2011

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    std::list< Candidate* >::iterator it = order_by_priority.begin();
    	while(  ( speed < (*it)->minspeed ) || ( speed > (*it)->maxspeed ) ){
    		++it;
    		if( it == order_by_priority.end() )
    			break;
    	}
    	if( it == order_by_priority.end() )
    		return NULL;
    	return *it;

    Про for забыли, по 2 раза проверяем...

    panter_dsd, 04 Февраля 2011

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

    +146

    1. 1
    2. 2
    3. 3
    char odin=1,odin2=1;
    if (&odin!=&odin2)
            Memo1->Lines->Add("FUCK!");

    я новичок, и после 3-й надписи FUCK! в Memo1 мой моск взорвалсо.
    помните меня таким, каким я был...

    myrik, 04 Февраля 2011

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

    +151

    1. 1
    2. 2
    3. 3
    4. 4
    ...
    else
                            priv->bDmDisableProtect = fasle;
    ...

    Всё было бы хорошо, не будь это исходники драйверов от Android...

    RaZeR, 03 Февраля 2011

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

    +162

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    vector<int> vi;
      vector<bool> vi_index;
      const unsigned unicode_size=0x10FFF;
      vi.resize (unicode_size+1);
      vi_index.resize (unicode_size+1);
      for (int fa=0;fa<vi.size();fa++) 
        vi[fa]=0;
      
      for (int fa=0;fa<vi.size();fa++) 
        vi_index[fa]=false;

    Человек не умеет инициализировать вектор. Ну, и пр.

    panter_dsd, 03 Февраля 2011

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

    +165

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    static string GetRequestParam(string request)
            {
                string result="";
                int i = 4;
                for(char c=request[i];c!=' ';c=request[++i])
                    result+=c;
                return result;
            }

    Говногость, 03 Февраля 2011

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    String^ TDebug::GetCurrentThreadFunctionName(int CallFunctionIndex)
    {
    	return (gcnew StackTrace(true))->GetFrame(CallFunctionIndex)->GetMethod()->ToString();
    };
    
    void TDebug::ShowCurrentFunctionName(void)
    {
    	Windows::Forms::MessageBox::Show(GetCurrentThreadFunctionName(2));
    };

    Помоему, в Microsoft Visual Studio 2010 отладчик для С++\CLI давно есть. :)

    Говногость, 03 Февраля 2011

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

    +172

    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
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    //уничтожение буфера
    void delbuf(void* &bf, char ntype)
    {
    	if (ntype=='C')
    	{
    		if (bf!=(char*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='B')
    	{
    		if (bf!=(BYTE*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='I')
    	{
    		if (bf!=(int*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='F')
    	{
    		if (bf!=(double*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='D')
    	{
    		if (bf!=(double*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='W')
    	{
    		if (bf!=(WORD*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='L')
    	{
    		if (bf!=(long*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='S')
    	{
    		if (bf!=(short*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	if (ntype=='R')
    	{
    		if (bf!=(DWORD*) NULL) 
    		{
    			delete[] bf;
    			bf=NULL;
    		}
    		return;
    	}
    	return;
    }

    86 строк вместо простого delete [] bf

    glprizes, 02 Февраля 2011

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