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

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

    −144

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    Функция ПроверкаОснДаты(Конт,Текст) Экспорт
    	Попытка	Дат=Конт.ДатаОперации;
    	Исключение
    		Попытка		Дат=Конт.ДатаДок;
    		Исключение	Дат='';	КонецПопытки;
    	КонецПопытки;
    	Если Дат<Константа.ОснДатаГл Тогда
    		ДействиеНеВыполнено(Шаблон("[Текст]. Период закрыт"));
    	КонецЕсли;
    	Возврат СтатусВозврата();
    КонецФункции

    Terrible, 19 Апреля 2012

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

    +78

    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
    > В какую середину?) он ставиться на свое место. У тебя не верное представление об устройстве данных в памяти. 
    
    procedure TForm1.Button1Click(Sender: TObject);
    type
    parr = ^tarr;
    tarr = array of integer;
    var
    pparr: array of parr;
    begin
    setlength(pparr,1);
    memo1.Lines.Add('first array pointer '+inttostr(integer(@pparr)));
    new(pparr[0]);
    memo1.Lines.Add('second array pointer '+inttostr(integer(pparr[0])));
    memo1.Lines.Add('first element '+inttostr(integer(pparr[0]^)));
    end;
    
    > вывод 
    
    first array pointer 1242664
    second array pointer 10822692
    first element 0

    Человек нашёл единственно верный путь использования двумерных динмассивов. Через указатель на указатель, правда он сам этого не понимает. Авторское форматирование и орфография сохранены.

    Источник:
    http://www.gamedev.ru/projects/forum/?id=161043&page=3#m35

    TarasB, 13 Апреля 2012

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

    +78

    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
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line1, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line2, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line3, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line4, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line5, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line6, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line7, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line8, 0, y));
    y+=drawable.getMinimumHeight();
    i++;
    mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line9, 0, y));

    вот так один паренек загружает в атлас текстуры....
    нафиг циклы вообще нужны (=

    TeknoMatik, 13 Апреля 2012

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

    +154

    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
    #include "stdafx.h"
    #include "expression.h"
    #include <vector>
    
    int _tmain(int argc, _TCHAR* argv[]) {
    //Инициализация
    	std::vector<expression> arrayOfExpressions;
    	std::string inputString;
    //Ввод количества выражений
    	printf( "Enter expressions count: " );
    	int countOfExpressions = 0;
    	scanf( "%d", &countOfExpressions );
    //Ввод самих выражений
    	for ( int i = 1; i <= countOfExpressions; i++ ) {
    		printf( "Enter expression: " );
    		scanf( "%s", inputString );
    		arrayOfExpressions.push_back( expression( inputString ) );
    	}
    //Подсчёт операторов
    	int total = 0;
    	for (int i = 0; i < arrayOfExpressions.size(); i++)
    		total += arrayOfExpressions.at(i).operatorsCount();
    	printf( "Total operators = %d", total );
    //Освобождение памяти
    	arrayOfExpressions.erase(arrayOfExpressions.begin(),arrayOfExpressions.end());
    	return 0;
    }

    Один из уже известных вам студентов написал вот это. Вроде получше.

    Fai, 11 Апреля 2012

    Комментарии (9)
  6. Java / Говнокод #9894

    +75

    1. 1
    if(batchControlImpl.startJobActivity(JobStatusType.STARTED));

    К проекту подключили активированных активных индусов.

    http://tinyurl.com/cvwefek

    roman-kashitsyn, 09 Апреля 2012

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

    +169

    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
    #define AS_STRING2(ARG) #ARG
    #define AS_STRING(ARG) AS_STRING2(ARG)
    
    #define PORT 5473
    		const uint16_t g_config_port=PORT;
    		const std::string g_config_port_string=AS_STRING(PORT);
    #undef PORT
    
    #define PORT 5474
    		const uint16_t g_request_port=PORT;
    		const std::string g_request_port_string=AS_STRING(PORT);
    #undef PORT
    
    #define PORT 5475
    		const uint16_t g_response_port=PORT;
    		const std::string g_response_port_string=AS_STRING(PORT);
    #undef PORT
    
    #undef AS_STRING
    #undef AS_STRING2

    Чувак нереально любит препроцессор, что говорит от том, что даже Страуструпа не читал.

    gvy, 06 Апреля 2012

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

    +159

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    #ifdef Status // we seem to pick up a macro Status --> int somewhere
    #undef Status
    #endif
    
    ...
    
        enum Status {

    Где-то мы макрос подхватили. qsettings.h

    Steve_Brown, 04 Апреля 2012

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

    +142

    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
    function get_row() {
            return $this->row;
        }
        function get_seo_row() {
            return $this->seo_row;
        }
        function get_template() {
            return $this->template;
        }
        function get_paginator() {
            return $this->paginator;
        }
        function get_caption() {
            return $this->caption;
        }
        function get_caption_null() {
            return $this->caption_null;

    ФункциАнально

    SuperChel, 03 Апреля 2012

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

    +155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    $psd=str_replace(',', '.', trim($csv[5]));
    $psd=str_replace('*', '', $psd);
    $strs=$psd;
    if($strs[(strlen($strs)-1)]==',' || $strs[(strlen($strs)-1)]=='.'){
    /*

    это пиздец, как я устал

    Sulik78, 02 Апреля 2012

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

    +119

    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
    string str;
            if (((str = path) != null) && (str != "basic"))
            {
                if (str == "contact")
                {
                    BindContact();
                    PageTitle = "Contact info";
                    editform.SetActiveView(vi_contact);
                    return;
                }
                if (str == "personal")
                {
                    PageTitle = "More about me";
                    BindPersonal();
                    editform.SetActiveView(vi_personal);
                    return;
                }
                if (str == "career")
                {
                    PageTitle = "Work info";
                    BindCareer();
                    editform.SetActiveView(vi_career);
                    return;
                }
                if (str == "tags")
                {
                    BindTags();
                    PageTitle = "Tags I Follow";
                    editform.SetActiveView(vi_tags);
                    return;
                }
                if (str == "biography")
                {
                    ph_page_title.Visible = false;
                    bind_biography();
                    editform.SetActiveView(vi_biography);
                    return;
                }
                if (str == "pp")
                {
                    ph_picpage_title.Visible = true;
                    ph_page_title.Visible = false;
                    PageTitle = "Edit profile photo";
                    BindProfilePhoto();
                    return;
                }
            }
    
            PageTitle = "Basic info";
            BindBasic();
            editform.SetActiveView(vi_basic);

    switch на диалекте хинди ;[ слава asp.net! убить Мартинса и Фаулера за чистокодную ересь!

    qwertylolman, 28 Марта 2012

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