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

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

    +63.4

    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
    /* This construction seems to be more optimiser friendly.
           (without it gcc does the isDIGIT test and the *s - '0' separately)
           With it gcc on arm is managing 6 instructions (6 cycles) per digit.
           In theory the optimiser could deduce how far to unroll the loop
           before checking for overflow.  */
        if (++s < send) {
          int digit = *s - '0';
          if (digit >= 0 && digit <= 9) {
            value = value * 10 + digit;
            if (++s < send) {
              digit = *s - '0';
              if (digit >= 0 && digit <= 9) {
                value = value * 10 + digit;
                if (++s < send) {
                  digit = *s - '0';
                  if (digit >= 0 && digit <= 9) {
                    value = value * 10 + digit;
    		        if (++s < send) {
                      digit = *s - '0';
                      if (digit >= 0 && digit <= 9) {
                        value = value * 10 + digit;
                        if (++s < send) {
                          digit = *s - '0';
                          if (digit >= 0 && digit <= 9) {
                            value = value * 10 + digit;
                            if (++s < send) {
                              digit = *s - '0';
                              if (digit >= 0 && digit <= 9) {
                                value = value * 10 + digit;
                                if (++s < send) {
                                  digit = *s - '0';
                                  if (digit >= 0 && digit <= 9) {
                                    value = value * 10 + digit;
                                    if (++s < send) {
                                      digit = *s - '0';
                                      if (digit >= 0 && digit <= 9) {
                                        value = value * 10 + digit;
                                        if (++s < send) {
                                          /* Now got 9 digits, so need to check
                                             each time for overflow.  */
                                          digit = *s - '0';
                                          while (digit >= 0 && digit <= 9
                                                 && (value < max_div_10
                                                     || (value == max_div_10
                                                         && digit <= max_mod_10))) {
                                            value = value * 10 + digit;
                                            if (++s < send)
                                              digit = *s - '0';
                                            else
                                              break;
                                          }
                                          if (digit >= 0 && digit <= 9
                                              && (s < send)) {
                                            /* value overflowed.
                                               skip the remaining digits, don't
                                               worry about setting *valuep.  */
                                            do {
                                              s++;
                                            } while (s < send && isDIGIT(*s));
                                            numtype |=
                                              IS_NUMBER_GREATER_THAN_UV_MAX;
                                            goto skip_value;
                                          }
                                        }
                                      }
    				 }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
    	 }
          }
        }

    Проверка числа в Perl-модуле. Судя по всему стояла задача оптимизировать под что-то.

    Thomas_55, 30 Декабря 2009

    Комментарии (4)
  3. Pascal / Говнокод #2353

    +92

    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
    {$R-}
    fal:=true;
    ty:= length(mas1);
    while(fal=true)  do
      for j:=0 to kp-1 do
      begin
        for i:=i+k+j to length(mas2)-1 do
        begin
          while mas2[i+k]= ty do
          begin
            s:=s+c[i,j];
            inc(k);
          end;
        end;
        nl:=mas1[ty-1];
        if nl=0 then
          mas_Mj[ty]:=0
        else
          mas_Mj[ty-1][j]:=s/nl;
        s:=0;
      end;

    TAX, 30 Декабря 2009

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

    +168.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
    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
    function check($pass) 
    { if (strpos($pass,'0') || strpos($pass,'1') 
        || strpos($pass,'2') || strpos($pass,'3') 
        || strpos($pass,'4') || strpos($pass,'5') 
        || strpos($pass,'6') || strpos($pass,'7') 
        || strpos($pass,'8') || strpos($pass,'9')) 
        { 
         if (strpos($pass,'a') || strpos($pass,'b') || strpos($pass,'c') 
             || strpos($pass,'d') || strpos($pass,'e') || strpos($pass,'f') 
             || strpos($pass,'g') || strpos($pass,'h') || strpos($pass,'i') 
             || strpos($pass,'j') || strpos($pass,'k') || strpos($pass,'l') 
             || strpos($pass,'m') || strpos($pass,'n') || strpos($pass,'o') 
             || strpos($pass,'p') || strpos($pass,'q') || strpos($pass,'r') 
             || strpos($pass,'s') || strpos($pass,'t') || strpos($pass,'u') 
             || strpos($pass,'v') || strpos($pass,'w') || strpos($pass,'x') 
             || strpos($pass,'y') || strpos($pass,'z')) 
             { 
              if (strpos($pass,'A') || strpos($pass,'B') || strpos($pass,'C') 
                  || strpos($pass,'D') || strpos($pass,'E') || strpos($pass,'F') 
                  || strpos($pass,'G') || strpos($pass,'H') || strpos($pass,'I') 
                  || strpos($pass,'J') || strpos($pass,'K') || strpos($pass,'K') 
                  || strpos($pass,'M') || strpos($pass,'N') || strpos($pass,'O') 
                  || strpos($pass,'P') || strpos($pass,'Q') || strpos($pass,'R') 
                  || strpos($pass,'S') || strpos($pass,'T') || strpos($pass,'U') 
                  || strpos($pass,'V') || strpos($pass,'W') || strpos($pass,'X') 
                  || strpos($pass,'Y') || strpos($pass,'Z')) 
                  {                if (ctype_lower(substr($pass,0,1)) || ctype_upper(substr($pass,0,1)) || is_numeric(substr($pass,0,1))) 
                       {                        if (ctype_lower(substr($pass,0,1))) 
                               {                             if (!ctype_lower(substr($pass,-1))) 
                                    {                                  return $pass;                                 }                            } 
                           if (ctype_upper(substr($pass,0,1))) 
                               { 
                                if (!ctype_upper(substr($pass,-1))) 
                                    { 
                                     return $pass; 
                                    } 
                               } 
                           if (is_numeric(substr($pass,0,1))) 
                               { 
                                if (!is_numeric(substr($pass,-1))) 
                                    { 
                                     return $pass; 
                                    } 
                               }                    } 
                  } 
             } 
        } }

    без коментариев. (из одного вап чата)

    [email protected], 28 Декабря 2009

    Комментарии (4)
  5. Куча / Говнокод #2338

    +122.4

    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
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
           <!--
    
    POSTER PHOTO
    
    -->
        <div id="poster-photo-container">
            <img src="images/photo-poster.jpg" alt="" class="poster-photo-image" />
              <div id="feature-area-home">
              
                  <div id="login" class="boxed">
    			<h2 class="title">Аккаунт пользователя</h2>
    			<div class="content">
    					<fieldset>
    					<legend>Войти</legend>
    					<label for="inputtext1">Аккаунт :</label>
    					<input id="inputtext1" type="text" name="inputtext1" value="" />
    					<label for="inputtext2">Пароль :</label>
                            <input id="inputtext2" type="password" name="inputtext2" value="" />
                            <asp:Button ID="Button1" runat="server" Text="Войти" onclick="Button1_Click" />
    
                             <p><a href="#">Забыли пароль ?</p>
    					    </a>
    					</fieldset>
    				</div>
    				
    		</div>
            </div>
        </div>
        <!--
    
    CONTENT CONTAINER
    
    -->
        <div id="content-container-two-column">
            <!--
    
    CONTENT MAIN COLUMN
    
    -->
            <div id="content-main-two-column">
                <h1>
                    <span lang="ru">Контроль измерительных приборов.</span> </h1>
                <p>
                    Consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet
                    dolore magna aliquam erat volutpat.</p>
                <div id="three-column-container">
                    <div id="three-column-side1">
                        <a href="Items.aspx">
                            <img src="images/home-photo-1.jpg" class="photo-border" alt="Enter Alt Text Here" /></a>
                        <h2>
                            <span lang="ru">Хромотографы ?</span></h2>
                        <p>
                            <span lang="ru">11111111</span></p>
                        <span lang="ru">
                        <a href="Items.aspx">Подробнее</a></span><img class="arrow" src="images/arrow.gif" alt="" /></div>
                </div>
            </div>
            <!--
    
    CONTENT SIDE COLUMN
    
    -->
            <div class="clear">
            </div>
        </div>
    </asp:Content>

    Найти DIV

    Nemerle, 28 Декабря 2009

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

    +103

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    MessageBox.Show(
     a.Decode(
      new StringBuilder(
       a.Encode(
         new StringBuilder(
           textBox1.Text)).ToString())).ToString());

    Говнокод... ну почти говнокод. Думаю, замечание.

    ajukraine, 22 Декабря 2009

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

    −106.6

    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
    # ВЫШЕ БУДЕТ МАСИВ С 1 до 7 за семь дней дабы делать выборку
    for ($indx=0; $indx<7; $indx++) {	## каждый раз работаем с датой
    @sql=();
    
    my $bindings = 0;
    
    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time+$indx*86400); # а тут надо будет написать что умножить эл. масива на чтото
    $date=($year+1900).'-'.($mon<9?'0':'').($mon+1).'-'.($mday<10?'0':'').$mday;
    $url2=$url.$date;
    #####$url2=$url;
    
    $cinema=&get($url2);
    
    ...
    
    } # это скобка массива

    Вот такой фрагмент парсера. Комменты читать по 3-4 раза для полного впечатления

    Suor, 22 Декабря 2009

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

    +163.4

    1. 1
    $file_dump->isOpened()?$file_dump->close():die ($file_dump->open());

    AlDjabad, 22 Декабря 2009

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

    −876

    1. 1
    INSERT INTO `x_world` VALUES (157282,-115,204,1,206320,'Жопа Волосатая',68797,'Чере',3277,'WarSky',595);

    Омг!
    Код взят с http://www.google.com/codesearch/p?hl=ru#Vh-Pv7tO-E0/map.sql&q=%D0%B6%D0%BE%D0%BF%D0%B0&sa=N& cd=8&ct=rc

    x0wl, 18 Декабря 2009

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

    +155.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
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    $dir = $_SERVER['DOCUMENT_ROOT'].'/upload/'.$_GET['ID'].'/';
    		$urlz = array();
    		if ($dh = opendir($dir))
    		{
    			clearstatcache();
    			while (($file = readdir($dh)) !== false)
    				if (strlen($file)>3 && substr($file, -4)!='.flv')
    				{
    					$FILE_PATH = $_SERVER['DOCUMENT_ROOT'].'/upload/'.$_GET['ID'].'/'.$file;
    					$TIME = filemtime($FILE_PATH);
    					while (array_key_exists($TIME,$urlz))
    						$TIME++;
    					if (filesize($FILE_PATH)>0)
    						$urlz[$TIME] = $file;
    				}
    		    closedir($dh);
    		    krsort($urlz);
    		}
    		$i = 0;
    		foreach ($urlz as $k=>$v)
    			if ($i>2)
    				unset($urlz[$k]);
    			else
    		    {
    		    	$i++;
    		        $urlz[$k] = 'http://www.'.$_SERVER['HTTP_HOST'].'/upload/'.$_GET['ID'].'/'.$v;
    			}

    atarix12, 17 Декабря 2009

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

    +153.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
    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
    function check_user($l, $p, $sex)
    	{
    	include("config.php");
    	c_mysql();
    	$q=mysql_query("select * from users where NICK='$l'");
    	$q=mysql_fetch_array($q,MYSQL_ASSOC);
    	
    	$qpass=$q["PASSWORD"];
    	$ban=$q["BAN"];
    	$id=$q["ID"];
    
    	if($qpass!="" and $qpass!=$p){ access_denied("не верный пароль");};
    	if($qpass!="" and $ban == 1){ access_denied("этот ник заблокирован");};
    	if($qpass!="" and $qpass==$p){ update_ip($id); build_frame($id, $sex);};
    	if($qpass==""){ new_user($l, $p);};
    
    
    	}
    function access_denied($why)
    	{
    	header("location: lock.php?$why");
    	exit;
    	}
    function title($S)
    	{
    	include("config.php");
    	echo "<title>$CHAT_NAME $S</title>
    	<meta http-equiv=\"Content-Type\" content=\"type/html; charset=windows-1251\"> ";

    разбираю свои исходники за 2005год

    anton, 17 Декабря 2009

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