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

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

    +18

    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
    char* GetConnectionName(){return "";}
    //---
    char*  NetworkMgr::getErrorString(int id)
    {
        if(this->idValid(id))
    {
    return errors[id];
    }
    else
    {
    return "!!!unknown error!!!";
    }
    }

    Из тела одного большого класса, я конечно понимаю что строки хранятся не в стеке, но всеравно.

    Psionic, 10 Сентября 2012

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

    +117

    1. 1
    new bool();

    сишарпненько...

    TarasB, 08 Сентября 2012

    Комментарии (36)
  4. PHP / Говнокод #11501

    +51

    1. 1
    AdminOrderListContentView::getAddressInfoWithoutApartment()

    Одна строчка кода но как много в ней...

    SET, 30 Июля 2012

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

    +31

    1. 1
    2. 2
    3. 3
    void Console :: clear() {
    	system("cls");
    }

    Fai, 23 Июля 2012

    Комментарии (36)
  6. Куча / Говнокод #11456

    +128

    1. 1
    2. 2
    3. 3
    func fff() func() func() func() string {
    	return func() func() func() string { return func() func() string { return func() string { return "DON'T DO THAT!" } } }
    }

    http://play.golang.org/p/KN4E1RotKl

    USB, 22 Июля 2012

    Комментарии (36)
  7. Pascal / Говнокод #11414

    +89

    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
    procedure TClickerAdvertising.Start(Item: TTaskItem);
      procedure StartTask(AURL: string);
      procedure SearchInYandex(Keywords, Domen: string);
        procedure SendSearchRequest;
        procedure CheckSearchRequest;
        procedure SearchLinkAndClick;
          function FindLinkInList: IHTMLElement;
        procedure CheckValidateTransition;
    
      procedure MoveAndGoBack(Domen: string; MoveCount, MoveDelay: Integer);
        function GetRandomElement: IHTMLElement;
    
      procedure FindAdvertLinkAndClick(AdvertType: TAdvertType; var AdvertLink: string);
        procedure ClickFromLinkToAdvert;
        procedure ClickFromGoogleAds;
    
      procedure SendReport(AURL: string);
        function GetIP: string;
        
    begin
    //...
    end;

    А як, Ви, ставитись до вкладених процедур?

    ADR, 14 Июля 2012

    Комментарии (36)
  8. Си / Говнокод #11324

    +135

    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
    float Q_rsqrt( float number )
    {
            long i;
            float x2, y;
            const float threehalfs = 1.5F;
     
            x2 = number * 0.5F;
            y  = number;
            i  = * ( long * ) &y;                       // evil floating point bit level hacking
            i  = 0x5f3759df - ( i >> 1 );               // what the fuck?
            y  = * ( float * ) &i;
            y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
    //      y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed
    
            return y;
    }

    The following code is the fast inverse square root implementation from Quake III Arena, stripped of C preprocessor directives, but including the exact original comment text.

    Вот что такое настоящие магические числа.

    bormand, 30 Июня 2012

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

    +56

    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
    <?php
    
    define(STATIC_SALT, "herz_salt");
    
    function generateRandChar()
    {
      $chars = 'abdefhiknrstyzABDEFGHKNQRSTYZ23456789';
      
      $numChars = strlen($chars);
      
      $string = '';
      
      for ($i = 0; $i < rand(1, 7); $i++) 
      {
          $string .= substr($chars, rand(1, $numChars) - 1, 1);
      }
      
      return $string;
    }
    
    $time = microtime(true) / 10000;
    
    $str = $time - floor($time);
    
    $str = (string)$str;
    
    $str = preg_replace('/0./', '', $str);
    
    $deleteNum = strlen($str);
    
    if($deleteNum  <= 5)
    {
        $str = substr($str, rand(0, 4));
    }
    elseif($deleteNum > 5 && $deleteNum  <= 10)
    {
        $str = substr($str, rand(5, 9));
    }
    else $str = substr($str, rand(7, 9));
    
    if(strlen($str) == 0)
    {
        $str = rand(0, 15000);
    }
    
    sleep(5);
    
    $str = sha1(md5($str . STATIC_SALT . microtime(true))) . generateRandChar();
    
    echo $str;
    
    ?>

    паранойя в действии :)

    Archont12, 16 Июня 2012

    Комментарии (36)
  10. JavaScript / Говнокод #10627

    +158

    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
    function check_email(_email)
    {
      var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789 ";
      var i = 0, j = 0;
      var match = false;
    
      if (_email.length == 0) {
        return false;
      }
    
      for (i = 0; i < _email.length; i++)
      {
        match = false;
        for (j = 0; j < letters.length; j++)
        {
          if (_email.charAt(i) == letters.charAt(j))
          {
            match = true;
            break;
          }
        }
    
        if (!match)
        {
          if (_email.charAt(i) == '.') {
            match = true;
          }
        }
    
        if(!match) {
          break;
        }
      }
     
      if (i >= _email.length) {
        return false;
      }
     
      if (_email.charAt(i++) != '@') {
        return false;
      }
    
      var dotpassed = false;
    
      while (i < _email.length)
      {
        var match = false;
        for (j = 0; j < letters.length; j++)
        {
          if (_email.charAt(i) == letters.charAt(j))
          {
            match = true;
            break;
          }
        }
     
      if (!match)
      {
        if (_email.charAt(i) == '.')
        {
          dotpassed = true;
          match = true;
        }
      }
    
      if (!match) return false;
      i++;
      }
     if (dotpassed) return true;
     return false;
    }

    в недрах http://astro.smsonline.ru/

    Timon, 08 Июня 2012

    Комментарии (36)
  11. Pascal / Говнокод #10030

    +121

    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
    procedure TForm1.Timer2Timer(Sender: TObject);
    begin
    image75.Visible:=false;image76.Visible:=false;
    image1.Visible:=true;image2.Visible:=true;image3.Visible:=true;
    image4.Visible:=true;image5.Visible:=true;image6.Visible:=true;
    image7.Visible:=true;image8.Visible:=true;image9.Visible:=true;
    image10.Visible:=true;image11.Visible:=true;image12.Visible:=true;
    image13.Visible:=true;image14.Visible:=true;image15.Visible:=true;
    image16.Visible:=true;image17.Visible:=true;image18.Visible:=true;
    image19.Visible:=true;image20.Visible:=true;image21.Visible:=true;
    image22.Visible:=true;image23.Visible:=true;image24.Visible:=true;
    image25.Visible:=true;image26.Visible:=true;image27.Visible:=true;
    image28.Visible:=true;image29.Visible:=true;image30.Visible:=true;
    image31.Visible:=true;image32.Visible:=true;image33.Visible:=true;
    image34.Visible:=true;image35.Visible:=true;image36.Visible:=true;
    image37.Visible:=true;image38.Visible:=true;image39.Visible:=true;
    image40.Visible:=true;image41.Visible:=true;image42.Visible:=true;
    image43.Visible:=true;image44.Visible:=true;image45.Visible:=true;
    image46.Visible:=true;image47.Visible:=true;image48.Visible:=true;
    image49.Visible:=true;image50.Visible:=true;image51.Visible:=true;
    image52.Visible:=true;image53.Visible:=true;image54.Visible:=true;
    image55.Visible:=true;image56.Visible:=true;image57.Visible:=true;
    image58.Visible:=true;image59.Visible:=true;image60.Visible:=true;
    image61.Visible:=true;image62.Visible:=true;image63.Visible:=true;
    image64.Visible:=true;image65.Visible:=true;image66.Visible:=true;
    image67.Visible:=true;image68.Visible:=true;image69.Visible:=true;
    image70.Visible:=true;image71.Visible:=true;image72.Visible:=true;
    image73.Visible:=true;
    if image1.left<360 then begin timer2.Enabled:=false;button2.Visible:=true;
    image1.Visible:=false;image2.Visible:=false;image3.Visible:=false;
    image4.Visible:=false;image5.Visible:=false;image6.Visible:=false;
    image7.Visible:=false;image8.Visible:=false;image9.Visible:=false;
    image10.Visible:=false;image11.Visible:=false;image12.Visible:=false;
    image13.Visible:=false;image14.Visible:=false;image15.Visible:=false;
    image16.Visible:=false;image17.Visible:=false;image18.Visible:=false;
    image19.Visible:=false;image20.Visible:=false;image21.Visible:=false;
    image22.Visible:=false;image23.Visible:=false;image24.Visible:=false;
    image25.Visible:=false;image26.Visible:=false;image27.Visible:=false;
    image28.Visible:=false;image29.Visible:=false;image30.Visible:=false;
    image31.Visible:=false;image32.Visible:=false;image33.Visible:=false;
    image34.Visible:=false;image35.Visible:=false;image36.Visible:=false;
    image37.Visible:=false;image38.Visible:=false;image39.Visible:=false;
    image40.Visible:=false;image41.Visible:=false;image42.Visible:=false;
    image43.Visible:=false;image44.Visible:=false;image45.Visible:=false;
    image46.Visible:=false;image47.Visible:=false;image48.Visible:=false;
    image49.Visible:=false;image50.Visible:=false;image51.Visible:=false;
    image52.Visible:=false;image53.Visible:=false;image54.Visible:=false;
    image55.Visible:=false;image56.Visible:=false;image57.Visible:=false;
    image58.Visible:=false;image59.Visible:=false;image60.Visible:=false;
    image61.Visible:=false;image62.Visible:=false;image63.Visible:=false;
    image64.Visible:=false;image65.Visible:=false;image66.Visible:=false;
    image67.Visible:=false;image68.Visible:=false;image69.Visible:=false;
    image70.Visible:=false;image71.Visible:=false;image72.Visible:=false;
    image73.Visible:=false;end
    else begin image1.left:=image1.Left-3;image1.top:=image1.top-1;
    image2.left:=image2.Left+2;image2.top:=image2.top+2;
    image3.left:=image3.Left-1;image3.top:=image3.top-3;
    image4.left:=image4.Left-2;image4.top:=image4.top+4;
    ...

    Ещё 65 строк кода!
    Анимация взрыва на Delphi 7.

    artar94, 24 Апреля 2012

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