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

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

    +987

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    enum State
    {
       NotOpened  = __LINE__;
       Waiting    = __LINE__;
       Opened     = __LINE__;
       Finished   = __LINE__;
       Terminated = __LINE__;
    };

    k06a, 14 Мая 2010

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

    +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
    [SecuritySafeCritical]
    public ObjectHandle CreateInstance(string assemblyName, string typeName)
    {
        if (this == null) // WTF?
        {
            throw new NullReferenceException();
        }
        if (assemblyName == null)
        {
            throw new ArgumentNullException("assemblyName");
        }
        return Activator.CreateInstance(assemblyName, typeName);
    }

    mscorlib 4.0
    System.AppDomain

    alexeykuptsov, 30 Апреля 2010

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

    +174

    1. 1
    if (ret_wx.charAt(0) == 'h' && ret_wx.charAt(1) == 't' && ret_wx.charAt(2) == 't' && ret_wx.charAt(3) == 'p' && ret_wx.charAt(4) == ':' && ret_wx.charAt(6) == '/' && ret_wx.charAt(6) == '/')

    Проверка, является ли строка URL'-ом

    Infamous, 23 Апреля 2010

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

    +106

    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
    // Вот так вот говнокодеры встречают конeц света:
    
    Function GetYear(StringYear : String) : Integer;
    Begin
     If StringYear = '2000' then result:=2000;
     If StringYear = '2001' then result:=2001;
     If StringYear = '2002' then result:=2002;
     If StringYear = '2003' then result:=2003;
     If StringYear = '2004' then result:=2004;
     If StringYear = '2005' then result:=2005;
     If StringYear = '2006' then result:=2006;
     If StringYear = '2007' then result:=2007;
     If StringYear = '2008' then result:=2008;
     If StringYear = '2009' then result:=2009;
     If StringYear = '2010' then result:=2010;
     If StringYear = '2011' then result:=2011;
     If StringYear = 'EndOfTheWorld' then result:=2012;
    End;

    Ну, как говорится, no comment :))))))))))

    ZLOvar, 22 Апреля 2010

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

    +59

    1. 1
    2. 2
    double _[1];
    void main(){[](){[](){[](){[](){0[_];}();}();}();}();};

    Осторожно! Новый стандарт превращает [этот язык, который нельзя называть по имени] в Perl при не верном использовании.

    C++0x, 21 Апреля 2010

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

    +83

    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
    public Map<ComponentType,
    				Map<GameType,
    					Map<SubGameType,
    						Map<String /*currency*/, 
    							Map<Stake /*stake*/, 
    								Map<Integer /*maxplayers*/, IPair<Long /*minChips*/, List<Long /*tableCode*/>>>
    							>
    						>
    					>
    				>
    			>
    			generate(int casinoCode) {
    
    		Map<ComponentType,
    			Map<GameType,
    				Map<SubGameType,
    					Map<String /*currency*/, 
    						Map<Stake /*stake*/, 
    							Map<Integer /*maxplayers*/, IPair<Long /*minChips*/, List<Long /*tableCode*/>>>
    						>
    					>
    				>
    			>
    		> result = new HashMap<ComponentType, Map<GameType,Map<SubGameType,Map<String,Map<Stake,Map<Integer,IPair<Long /*minChips*/, List<Long /*tableCode*/>>>>>>>>();
    
    		Map<GameType,
    		Map<SubGameType,
    			Map<String /*currency*/, 
    				Map<Stake /*stake*/, 
    					Map<Integer /*maxplayers*/, IPair<Long /*minChips*/, List<Long /*tableCode*/>>>
    				>>>> componentTypeMap = new HashMap<GameType, Map<SubGameType,Map<String,Map<Stake,Map<Integer,IPair<Long /*minChips*/, List<Long /*tableCode*/>>>>>>>();
    
    ....
    
    			Map<SubGameType,
    			Map<String /*currency*/, 
    				Map<Stake /*stake*/, 
    					Map<Integer /*maxplayers*/, IPair<Long /*minChips*/, List<Long /*tableCode*/>>>>>> gameTypeMap = new HashMap<SubGameType, Map<String,Map<Stake,Map<Integer,IPair<Long /*minChips*/, List<Long /*tableCode*/>>>>>>();

    Made in Estonia

    bot225, 19 Апреля 2010

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

    +56.6

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    interfaceSprites[0]=new hgeSprite(interfaceSet,32,0,10,10);
        interfaceSprites[1]=new hgeSprite(interfaceSet,42,0,10,10);
        interfaceSprites[2]=new hgeSprite(interfaceSet,52,0,10,10);
        interfaceSprites[3]=new hgeSprite(interfaceSet,32,10,10,10);
        interfaceSprites[4]=new hgeSprite(interfaceSet,42,10,10,10);
        interfaceSprites[5]=new hgeSprite(interfaceSet,52,10,10,10);
        interfaceSprites[6]=new hgeSprite(interfaceSet,32,20,10,10);
        interfaceSprites[7]=new hgeSprite(interfaceSet,42,20,10,10);
        interfaceSprites[8]=new hgeSprite(interfaceSet,52,20,10,10);

    весело, что это более читабельно, чем с циклом...

    MyParanoya, 16 Апреля 2010

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

    +152.2

    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
    function ShowMsg($text)
    {
        if(session_is_registered('xynta')) $un = base64_decode(strrev($_SESSION['xynta']));
        else $un = "%USERNAME%";
        $text = str_replace("%%USERNAME%%",$un,$text);
        $text = preg_replace("/\[img\](.+?)\[\/img\]/is","<img src=\"\\1\" />",$text);
        $text = preg_replace("/\[bkb\](.+?)\[\/bkb\]/is","<span class=bkb>\\1</span>",$text);
        $text = preg_replace("/\[move\](.+?)\[\/move\]/is","<marquee>\\1</marquee>",$text);
        $text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","<blockquote>\\1</blockquote>",$text);
        $text = preg_replace("/\[center\](.+?)\[\/center\]/is","<center>\\1</center>",$text);
        $text = preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$text);
        $text = preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$text);
        $text = preg_replace("/\[u\](.+?)\[\/u\]/is","<u>\\1</u>",$text);
        $text = preg_replace("/\[s\](.+?)\[\/s\]/is","<s>\\1</s>",$text);
        $text = preg_replace("/\[code\](.+?)\[\/code\]/is","<code>\\1</code>",$text);
        $text = preg_replace("/\[effekt\](.+?)\[\/effekt\]/is","<div style='padding: 20px;display:block;'><span id=effekt name=effekt>\\1</span></div>",$text);
        $text = preg_replace("/\[blink\](.+?)\[\/blink\]/is","<span id=blink name=blink>\\1</span>",$text);
        //    $text = preg_replace("/\[flash\](.+?)\[\/flash\]/is","<embed type='application/x-shockwave-flash' width=640 height=480 src=\\1 />",$text);
        $text = preg_replace_callback("/\[mp3\](.+?)\[\/mp3\]/is","mp3_safe_url",$text);
        $text = preg_replace("/\[bg=(.+?)\](.+?)\[\/bg\]/is","<span style='background:\\1'>\\2</span>", $text);
        $text = preg_replace("#\[url\](.+?)\[/url\]#is", "<a href=http://www.dereferer.org/?\\1 target=_blank>\\1</a>", $text);
        if(!strstr($text,"<br")) $text=nl2br($text);
        return $text;
    }

    diio, 15 Апреля 2010

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

    +142.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
    using System;
    
    class program
    {
        unsafe public static void Foo(int* pa)
        {
            for (int* ip = pa; ip < (pa+5); ip++)
            {
                Console.WriteLine("value {0} at address: {1}", *ip, (int)ip);
            }
        }
       
        static void Main(string[] args)
        {
            unsafe
            {
                int* pa = stackalloc int[5];
                pa[0] = 12;
                pa[1] = 34;
                pa[2] = 56;
                pa[3] = 78;
                pa[4] = 90;
                Foo(pa);
            }
        }
    }

    Использование stackalloc для выделения памяти под массив

    sergylens, 08 Апреля 2010

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

    +150.2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    /**
    	* gets the HTTP body for the current request.
    	*
    	* @param string $soapmsg The SOAP payload
    	* @return string The HTTP body, which includes the SOAP payload
    	* @access private
    	*/
    	function getHTTPBody($soapmsg) {
    		return $soapmsg;
    	}

    нашел где то в сорцах nusoap

    nur, 07 Апреля 2010

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