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

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

    +157

    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
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>домо окошко</title>
    <link rel="stylesheet" href="tools/style.css" type="text/css" />
    <script type="text/javascript">
    function fMask(){
    	var h = document.getElementById('bodyblock').offsetHeight;
    	document.getElementById('mask').style.height = h + "px";
    	var hmodal = document.getElementById('modalBlock').offsetHeight -6;
    	document.getElementById('modalLeft').style.height = hmodal + "px";
    	document.getElementById('modalRight').style.height = hmodal + "px";
    }
    </script>
    <script type="text/javascript" src="tools/jquery.js"></script>
    <script type="text/javascript" src="tools/select.js"></script>
    <script type="text/javascript">$(document).ready(function(){$('.selectBlock').sSelect();});</script>
    </head>
    <body id="bodyblock" onload="fMask();">
    <div id="mask"></div>
    
    <div id="modal">

    лалала жужужужу я програмлю как могу... из серии не заставляйте верстальщиков применять JS

    nur, 02 Июля 2010

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

    +165

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //где-то в далеком-далеком хедере
    typedef long SystemID;
    
    // в коде
    long FARPASCAL sb_ConfigureSystem(SystemID s)
    {
                 .......
                 System * sys = (System*)s;
                 ......
    }

    И в таком духе весь проект.

    DarthBobr, 30 Июня 2010

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

    +136

    1. 1
    if (this.Visible || this.Invisible)

    обнаружено в коде коммерческой CMS

    mozg_raka, 25 Июня 2010

    Комментарии (5)
  5. Java / Говнокод #3436

    +75

    1. 1
    2. 2
    3. 3
    if ((getProductId() != null) && (getProductId().equals(new String("5")))) {
      //do it
    }

    ProductId читается один раз при старте приложения, а таких проверок около 50-и.

    lotik, 10 Июня 2010

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

    +153

    1. 1
    2. 2
    3. 3
    // Является ли это говнокодом?
    <form action="prog.php?a=1&b=2" method="POST">
    ...

    Говнокод или так можно делать?

    Tanger, 09 Июня 2010

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

    +106

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    proxy1.GetMeasurements(
                new AccountingMeasurementType(255, "Тип документа")))
                            .ToList()
                            .FirstOrDefault(item => 
                                        item.Name.Equals("Спецификация")
                            ),
                SpecificationDS.DateFrom as DateTime?,
                SpecificationDS.DateTo as DateTime?)
    );

    Мало того что в коде прошита сразу куча строк, так еще и числовая константа %)

    User123, 08 Июня 2010

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

    +141

    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
    for (int x=0; x < TANK_SIZE; x++)
    
    	{
    
    		for (int y=0; y < TANK_SIZE; y++)
    
    		{
    
    			*((Uint32 *)(((Uint8 *)player_surface[DOWN]->pixels) + (TANK_SIZE - y - 1) * player_surface[DOWN]->pitch + (TANK_SIZE - x - 1) * player_surface[DOWN]->format->BytesPerPixel)) = *((Uint32 *)(((Uint8 *)player_surface[LEFT]->pixels) + (TANK_SIZE - x - 1) * player_surface[LEFT]->pitch + y * player_surface[LEFT]->format->BytesPerPixel)) = *((Uint32 *)(((Uint8 *)player_surface[RIGHT]->pixels) + x * player_surface[RIGHT]->pitch + (TANK_SIZE - y - 1) * player_surface[RIGHT]->format->BytesPerPixel)) = *((Uint32 *)(((Uint8 *)player_surface[UP]->pixels) + y * player_surface[UP]->pitch + x * player_surface[UP]->format->BytesPerPixel));
    
    			*((Uint32 *)(((Uint8 *)enemy_surface[DOWN]->pixels) + (TANK_SIZE - y - 1) * enemy_surface[DOWN]->pitch + (TANK_SIZE - x - 1) * enemy_surface[DOWN]->format->BytesPerPixel)) = *((Uint32 *)(((Uint8 *)enemy_surface[LEFT]->pixels) + (TANK_SIZE - x - 1) * enemy_surface[LEFT]->pitch + y * enemy_surface[LEFT]->format->BytesPerPixel)) = *((Uint32 *)(((Uint8 *)enemy_surface[RIGHT]->pixels) + x * enemy_surface[RIGHT]->pitch + (TANK_SIZE - y - 1) * enemy_surface[RIGHT]->format->BytesPerPixel)) = *((Uint32 *)(((Uint8 *)enemy_surface[UP]->pixels) + y * enemy_surface[UP]->pitch + x * enemy_surface[UP]->format->BytesPerPixel));
    
    			
    
    		}
    
    	}

    dageru, 03 Июня 2010

    Комментарии (5)
  9. Си / Говнокод #3385

    +130

    1. 1
    2. 2
    3. 3
    #if defined (CAMCORDER_FEATURE_SUPPORT_VIEW_MODE)
    //		case SETTING_VIEW_MODE:	
    #endif

    aljosha, 03 Июня 2010

    Комментарии (5)
  10. Си / Говнокод #3384

    +136

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if(TouchRegist && !gIsCleanView && !gChangeZoom &&!gChangeBrightness)
    			if( TouchRegist && gChangeZoom)
    			{
    				...
    			}	
    			break;

    aljosha, 03 Июня 2010

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

    +1003

    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
    // укорочено для краткости.
    void ATraceClass::LogFunction(const char *format, va_list ap)
    {
      /* ... declarations ... */
    
      for (p=format; (*p)&&(!isTruncated); p++)
      {
        if ( * p == '%' )
          switch( * ++p )
          {
            case 'c':
            { /* ... */ }
            break;
    
            case 'd':
            case 'i':
            { /* ... */ }
            break;
    
            case 'l':   // это %ld
            { /* ... */ }
            break;
    
            case 'L':    // это %Ld
            { /* ... */ }
            break;
      
            case 'f':   // a это %g
            { /* ... */ }
            break;
    
            case 'F':  // a это %Lg
            { /* ... */ }
            break;
    
            case 's': 
            { /* ... */ }
            break;
    
            default: // this is an ERROR case, but we will not perform coding at this point ... maybe later
              break;
          }
          else {
            /* ... */
          }
      }
    }

    наболело. одно чудило (с большой букмы Му) наговнокодило это дело под эгидой "stdio это С, мы в С++ можем круче!!!" ну с тех пор и переизобретают велосипед - с квадратными колёсами. даже %% не догадались сделать.

    уже как года два давлю вот это Г, но наши немецкие умельцы копи-пастят это в новые модуля быстрее чем я успеваю это удалять.

    самое гадкое что народ пишет код как обычно ожидая стандартные stdio шорткаты, и потом долго гадает куда блин сообщение подевалось.

    Dummy00001, 31 Мая 2010

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