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

    В номинации:
    За время:
  2. 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)
  3. Куча / Говнокод #3431

    +153

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

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

    Tanger, 09 Июня 2010

    Комментарии (5)
  4. 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)
  5. Си / Говнокод #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)
  6. Си / Говнокод #3385

    +130

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

    aljosha, 03 Июня 2010

    Комментарии (5)
  7. Си / Говнокод #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)
  8. 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)
  9. Си / Говнокод #3260

    +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
    17. 17
    18. 18
    19. 19
    /* TODO: make this into something smarter than a linked list */
    typedef struct bunchOfInstances_t {
        ncInstance * instance;
        int count; /* only valid on first node */
        struct bunchOfInstances_t * next;
    } bunchOfInstances;
    
    ncInstance * get_instance (bunchOfInstances **headp)
    {
        static bunchOfInstances * current = NULL;
        
        /* advance static variable, wrapping to head if at the end */
        if ( current == NULL ) current = * headp;
        else current = current->next;
        
        /* return the new value, if any */
        if ( current == NULL ) return NULL;
        else return current->instance;
    }

    raorn, 18 Мая 2010

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

    +166

    1. 1
    2. 2
    if($posting == 0) {
      if(!isset($posting) && count($fld)) {

    Всё та же NetCat 3.6.

    telnet, 18 Мая 2010

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public bool Inverse(bool value){
       if(value.ToString().Length == 4)
          return false;
       else return true;
    }

    было дело...

    tazakara, 17 Мая 2010

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