1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #1713

    +157.2

    1. 1
    if(preg_match("/\.[gjpi][ipnc][fgo]/i", $_SERVER['REQUEST_URI'])) exit;

    gorvic, 28 Августа 2009

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

    +8.1

    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
    // файлToolStripMenuItem
    			// 
    			this->файлToolStripMenuItem->Name = L"файлToolStripMenuItem";
    			this->файлToolStripMenuItem->Size = System::Drawing::Size(54, 22);
    			this->файлToolStripMenuItem->Text = L"Файл";
    			this->файлToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::файлToolStripMenuItem_Click);
    			// 
    			// Form1
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->ClientSize = System::Drawing::Size(292, 260);
    			this->Controls->Add(this->button1);
    			this->Controls->Add(this->menuStrip1);
    			this->MainMenuStrip = this->menuStrip1;
    			this->Name = L"Form1";
    			this->Text = L"Form1";
    			this->menuStrip1->ResumeLayout(false);
    			this->menuStrip1->PerformLayout();
    			this->ResumeLayout(false);
    			this->PerformLayout();
    
    		}
    #pragma endregion
    	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
    			 }
    	private: System::Void меню1ToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    			 }
    private: System::Void файлToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    		 }
    private: System::Void выходToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
    		 }
    };

    MS VS 2005 - MS VS 2008 это спокойно компилирует, да ещё и сама код генерирует, когда на формочке рисуешь русское меню.
    Этот компилятор определённо соответсвует стандарту С++.

    Говногость, 18 Августа 2009

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

    +12.1

    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
    class TIntArray
    {
    	char buf[10000];
    	int operator[](int Index);
    };
    
    ...
    
    void main()
    {
    	TIntArray a;
    	...
    	memset(&a[1],0.0f,sizeof(TIntArray));
    	...
    };

    Меня этот кот довёл до слёз...

    Говногость, 18 Августа 2009

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

    +13.1

    1. 1
    2. 2
    3. 3
    #define REGISTER_PACKET(cls, type)\
    __declspec(selectany) PacketType cls::s_type = CPacketFactory::RegisterPacket(type, cls::CreateNew); \
    __pragma(comment(linker, "/include:?s_type@##cls##@@2W4PacketType@@C"))

    Очень правильный код... Делать можно только так.

    Говногость, 18 Августа 2009

    Комментарии (11)
  6. Си / Говнокод #1596

    +136

    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
    #include <stdio.h>
    #include <pthread.h>
    #include <unistd.h>
    #include <math.h>
    #include <stdlib.h>
    
    struct thread_arg
    {
    	int a;
    	int b;
    	int c;
    	double d;
    };
    	
    
    void *ret_x1(void *arg)
    {
    		
    	struct thread_arg targ = *(struct thread_arg *)arg;
    	double x1;
    	x1 = (-targ.b + sqrt(targ.d)) / (2*targ.a);
    
    	fprintf(stderr, "x1 = %f\n", x1);
    
    	return NULL;
    }
    
    void *ret_x2(void *arg)
    {
    	struct thread_arg targ = *(struct thread_arg*)arg;
    	double x2;
    	x2 = (-targ.b - sqrt(targ.d)) / (2*targ.a);
    
    	
    
    	fprintf(stderr, "x2 = %f\n", x2);
    	
    	return NULL;
    }
    
    int main(void)
    {
    	pthread_t thread1, thread2;
    	struct thread_arg args;
    
    	fprintf(stderr, "Enter a, b and c\n");
    	scanf("%d %d %d", &args.a, &args.b, &args.c);
    	
    	args.d = args.b*args.b - 4*args.a*args.c;
    
    	if(args.d < 0)
    	{
    		fprintf(stderr,"There is no roots\n");
    		return 0;
    	}
    	else
    	{
    		if(pthread_create(&thread1, NULL, &ret_x1, &args) != 0)
    		{
    			fprintf(stderr, "Error1\n");
    			return 1;
    		}
    		if(pthread_create(&thread2, NULL, &ret_x2, &args) != 0)
    		{
    			fprintf(stderr, "Error2\n");
    			return 1;
    		}
    		pthread_join(thread1, NULL);
    		pthread_join(thread2, NULL);
    
    	}
    	return 0;
    		
    }

    Многопоточное решение квадратного уравнения...

    zitzy, 16 Августа 2009

    Комментарии (11)
  7. PHP / Говнокод #1578

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $cnt_ = count($array_objects['rate']);
    
    for($i=0; $i<$cnt_; $i++) {
      //...
    }
    
    $DB->query('REPAIR TABLE `' . $rates_table . '` QUICK;');

    Кусок скрипта для импорта данных из XML...

    Eisenhorn, 13 Августа 2009

    Комментарии (11)
  8. Java / Говнокод #1522

    +76.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    try {
        ....
    } catch (Exception ex) {
        if (ex != null) {
            try {
                ex.printStackTrace();
            } catch(Exception ex1) {
                ....
            }
        }
    }

    Rudolf_Abel, 11 Августа 2009

    Комментарии (11)
  9. PHP / Говнокод #1465

    +137.7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
    $num_rows = mysql_num_rows($q);
    for ($m=0; $m<$num_rows; $m++)
    {
     $q = mysql_query ("SELECT * FROM theodorakisdiscographygre");
     for ($c=0; $c<($num_rows-$m); $c++)
     {
      $f = mysql_fetch_array($q);
     }
     echo $f["content"];
    }

    сортировка

    guest, 05 Августа 2009

    Комментарии (11)
  10. PHP / Говнокод #1382

    +152.3

    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
    if($_POST[tel]=='')
    	{
    		print "<script language=\"javascript\">\n";
    		print "showmsg('tel');\n";
    		print "</script>\n";
    	}
    	if($_POST[name]=='')
    	{
    		print "<script language=\"javascript\">\n";
    		print "showmsg('name');\n";
    		print "</script>\n";
    	}
    	if(($_POST[name]!='')&&($_POST[tel]!=''))
    	{
    		print "<meta http-equiv=\"Refresh\" content=\"0;URL=send.php?name=$_POST[name]&tel=$_POST[tel]\" />\n";
    		die();
    	}

    Разбираю один движок инет-магазина. Первое что я понял - автор идиот. Второе - он совершенно ничего не знает об elseif'ах

    guest, 18 Июля 2009

    Комментарии (11)
  11. PHP / Говнокод #1302

    +142

    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
    function roundPagesCount($int)
    {
    	if ($int / 1000000000 > 1) {
    		return round($int/1000000000). ' млрд';
    	}
    
    	if ($int / 1000000 > 1) {
    		return round($int/1000000). ' млн';
    	}
    
    	if ($int / 1000 > 1) {
    		return round($int/1000). ' тыс';
    	}
    
    }

    без слов))))

    guest, 01 Июля 2009

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