- 1
- 2
- 3
- 4
- 5
- 6
- 7
void
timerfunc(int sig)
{
signal(SIGALRM, timerfunc);
TimerCount++;
TimerCallFunc();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+30
void
timerfunc(int sig)
{
signal(SIGALRM, timerfunc);
TimerCount++;
TimerCallFunc();
}
найдено в "примере"
0
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/
−2
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);
}
}
Подбирание и выкидывание оружия
0
#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
+1
#pragma aux __cdecl "_*" \
parm caller [ ] \
value struct float struct routine [eax] \
modify [eax ecx edx]
0
#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))
+3
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 + зачем-то фильтруем полученный массив в каждой итерации.
Причем этот код можно записать в одну строку, которая еще и будет работать быстрее.
0
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
−1
С помощью вербальных вибраций можно отправлять мыслеформы в плотские тела либо жидкости и предметы.
Практического применения пока не имеет.
gorcom.com
narcom.com
profcom.com
anacom.com
+1
ДокументСсылка = парВыборка.Документ;
Если СокрЛП(ДокументСсылка) = "" Тогда
Продолжить;
КонецЕсли;
А как вы проверяете на ПустуюСсылку?