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

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

    +30

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    void
    timerfunc(int sig)
    {
      signal(SIGALRM, timerfunc);
      TimerCount++;
      TimerCallFunc();
    }

    найдено в "примере"

    guest, 01 Декабря 2008

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

    0

    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
    char *SomeGlobalPointer {};
    
    void foo()
    {
      SomeGlobalPointer = new char[1024];
    }
    
    int main()
    {
      foo();
    
      if (!SomeGlobalPointer)
      {
        delete[] SomeGlobalPointer;
      }
    
      return 0;
    }

    Отсюдова:

    https://pvs-studio.ru/ru/blog/posts/cpp/1068/

    CEHT9I6PbCKuu_nemyx, 13 Сентября 2023

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

    −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
    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
    public class WeaponHold : MonoBehaviour
    {
        public bool equip;
        public float distance = 0.3f;
        public RaycastHit2D hit;
        public Transform holdPoint; //Здесь задаются координаты дочернего объекта у игрока
        public float put = 1f;
     
        public void Update()
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                if (!equip)
                {
                    Physics2D.queriesStartInColliders = false;
                    hit = Physics2D.Raycast(transform.position, Vector2.right * transform.localScale.x, distance);
     
                    if (hit.collider != null && hit.collider.tag == "Gun")
                    {
                        equip = true;
                        Debug.Log("Оружие видно");
                    }
                }
            }
            else
            {
                equip = false;
     
                if (hit.collider.gameObject.GetComponent<Rigidbody2D>() != null)
                {
                    hit.collider.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(transform.localScale.x, 1) * put;
                } 
            }
            if (equip)
            {
                Debug.Log("Оружие перемещено");
                hit.collider.gameObject.transform.position = holdPoint.position;  //Здесь мы поднимаем дробовик, перемещая его к дочернему объекту
            }
        }
     
        private void OnDrawGizmos()
        {
            Gizmos.color = Color.red; //Прорисовка RayCast
            Gizmos.DrawLine(transform.position, transform.position + Vector3.right * transform.localScale.x * distance);
        }
    }

    Подбирание и выкидывание оружия

    govnotochkar, 02 Августа 2022

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

    0

    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
    #include <clcpp/clcpp.h>
    #include <clcpp/FunctionCall.h>
    
    
    // Reflect the entire namespace and implement each class
    clcpp_reflect(TestClassImpl)
    namespace TestClassImpl
    {
    	class A
    	{
    	public:
    		A()
    		{
    			x = 1;
    			y = 2;
    			z = 3;
    		}
    
    		int x, y, z;
    	};
    
    	struct B
    	{
    		B()
    		{
    			a = 1.5f;
    			b = 2.5f;
    			c = 3.5f;
    		}
    
    		float a, b, c;
    	};
    }
    
    clcpp_impl_class(TestClassImpl::A)
    clcpp_impl_class(TestClassImpl::B)
    
    void TestConstructorDestructor(clcpp::Database& db)
    {
    	const clcpp::Class* ca = clcpp::GetType<TestClassImpl::A>()->AsClass();
    	const clcpp::Class* cb = clcpp::GetType<TestClassImpl::B>()->AsClass();
    
    	TestClassImpl::A* a = (TestClassImpl::A*)new char[sizeof(TestClassImpl::A)];
    	TestClassImpl::B* b = (TestClassImpl::B*)new char[sizeof(TestClassImpl::B)];
    
    	CallFunction(ca->constructor, a);
    	CallFunction(cb->constructor, b);
    
    	CallFunction(ca->destructor, a);
    	CallFunction(cb->destructor, b);
    
    	delete [] (char*) a;
    	delete [] (char*) b;
    }

    https://github.com/Celtoys/clReflect/blob/master/src/clReflectTest/TestClassImpl.cpp

    kcalbCube, 14 Июня 2022

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    #pragma aux __cdecl "_*"                            \
                    parm caller [ ]                          \
                    value struct float struct routine [eax] \
                    modify [eax ecx edx]

    kcalbCube, 28 Февраля 2022

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

    0

    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
    #define debut     {
    #define fin       }
    #define si        if
    #define alors     {
    #define sinon     } else {
    #define sinonsi   } else if
    
    #define repeter   do {
    #define jusqua    } while (!
    
    #define choix     switch
    #define quand     case
    
    #define retourner return

    какой gaffe))

    kcalbCube, 19 Февраля 2022

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

    +3

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    public getWay(path: string) {
        const arrPath = path.slice(1).split('/');
    
        arrPath.map(item => {
          this.crumbs.push(MathcPath[item]);
          this.crumbs = this.crumbs.filter(crumb => crumb);
        });
    }

    Используем map в качестве forEach + зачем-то фильтруем полученный массив в каждой итерации.
    Причем этот код можно записать в одну строку, которая еще и будет работать быстрее.

    kage-senshi, 17 Января 2022

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

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    if  (  (sd<>5)  )    and  //    (Material.ReadOnlySklad =false)      and
              (
                  (     Material.TypeSkladId <> 4    )  and
                  (
                 //    (Material.UserBuh = true )  or (Material.UserAdmin = true)     or
                         (Material.DisunionByOssSb=true )  or  ( credit_operation = true )
    
                  )
                )
               then

    Baiumka, 10 Января 2022

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

    −1

    1. 1
    2. 2
    С помощью вербальных вибраций можно отправлять мыслеформы в плотские тела либо жидкости и предметы.
    Практического применения пока не имеет.

    gorcom.com
    narcom.com
    profcom.com
    anacom.com

    MPAMOP, 25 Декабря 2021

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

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    ДокументСсылка = парВыборка.Документ;
    		Если СокрЛП(ДокументСсылка) = "" Тогда
    			Продолжить;
    		КонецЕсли;

    А как вы проверяете на ПустуюСсылку?

    timofeysin, 26 Ноября 2021

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