-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+273
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
#include <math.h>
#include <stdio.h>
double DoubleToTheInt(double base, int power) {
return pow(base, power);
}
int main() {
// приводим к указателю на функуцию с обратным порядком аргументов
double (*IntPowerOfDouble)(int, double) =
(double (*)(int, double))&DoubleToTheInt;
printf("(0.99)^100: %lf \n", DoubleToTheInt(0.99, 100));
printf("(0.99)^100: %lf \n", IntPowerOfDouble(100, 0.99));
}
"Изящный способ отстрелить себе ногу по самую голову."
Утащено с Хабры.
Vindicar,
15 Августа 2016
-
+4
Итак, прыщеблядки. Console.WriteLine() в C# в windows 7 замечательно выводит юникод в консоли после chcp 65001, что в консоль, что в файл (в формате utf-8 без BOM). Жду ваших оправданий, почему это не работает в ваших "кроссплатформенных" поделиях вроде питона.
3_14dar,
15 Сентября 2015
-
+84
- 1
- 2
- 3
- 4
- 5
- 6
- 7
public static int getNumber() {
try {
return 7;
} finally {
return 43;
}
}
Оказывается так делать можно...
Qwertiy,
14 Апреля 2015
-
−1
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
#define BYPASS_AV_BEGIN char* memdmp = NULL;memdmp = (char*)malloc(100000000);if (memdmp != NULL){int cpt = 0;for (int i = 0; i < 100000000; i++){cpt++;}if (cpt == 100000000){HANDLE file;HANDLE proc;proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, 4);if (proc == NULL){LPVOID mem = NULL;mem = VirtualAllocExNuma(GetCurrentProcess(), NULL, 100, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE, 0);if (mem != NULL){DWORD result = FlsAlloc(NULL);if (result != FLS_OUT_OF_INDEXES){
#define BYPASS_AV_END }}}}}
int main()
{
BYPASS_AV_BEGIN
//malware code...
BYPASS_AV_END
}
Обход антивирусов и антивирусных виртуалок
https://lolzteam.org/threads/1275661/
Stallman,
31 Декабря 2019
-
+4
3_15dar,
22 Июля 2019
-
+25189
- 1
- 2
- 3
- 4
Обратил внимание, что сток превратился в обычное обсуждение в чате.
Все читают всех, оффтопят, и похер в каком треде. А также когда я проверяю новые сообщения, хожу в телеграм, потом на хуз.
Поэтому создал бота в телеге, который фактически повторяет функционал стока + можно оставлять комменты (конечно же они будут от guest8).
По-моему получилось охуенно.
http://t.me/GovnokodBot
- посылаются посты и комменты
- работает отправка и редактирование
- если кто-то постит ссылку на картинку или youtube, телега автоматически отображает превью - удобно
- нужно использовать bbcode
- markdown -> bbcode - в TODO
guest8,
20 Мая 2019
-
+31
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
#include <string>
#include <iostream>
#include <functional>
using namespace std;
template<class L, class... Ls>
struct OL: L, OL<Ls...>{
OL(const L& l, const Ls&... ls): L(l), OL<Ls...>(ls...){}
using L::operator();
using OL<Ls...>::operator();
};
template<class L1, class L2>
struct OL<L1, L2>: L1, L2{
OL(const L1& l1, const L2& l2): L1(l1), L2(l2){}
using L1::operator();
using L2::operator();
};
template<class... Ls>
OL<Ls...> OverloadLambda(const Ls&... l){
return OL<Ls...>(l...);
}
template<class L>
L OverloadLambda(const L& l){
return l;
}
void OverloadLambda(void) = delete;
int main() {
int i=5;
auto lambda=OverloadLambda( [=](int v){cout<<__func__<<" "<<i<<" "<<v<<" int"<<endl;},
[=](string v){cout<<__func__<<" "<<i<<" "<<v<<" string"<<endl;},
[=](float v){cout<<__func__<<" "<<i<<" "<<v<<" float"<<endl;});
lambda(0);
lambda("Hello");
lambda(1.0f);
i=600;
auto lambda1=OverloadLambda( [=](int v){cout<<__func__<<" "<<i<<" "<<v<<" int"<<endl;});
lambda1(4);
///*auto lambda0 =*/ OverloadLambda();
return 0;
}
Специальная олимпиада объявляется открытой!
http://ideone.com/y14z5Y
Там много другого кода и какой-то из старых тем, а мне лень весь облазить.
LispGovno,
03 Февраля 2014
-
+126
- 1
shop_manager.WarnCurrentStoreNotTracked = Current store is not tracked. Please <a href="#" onclick="company.load_page(\'analytics/activate.html\', '{'\'{0}\': \'{1}\''}');">activate here</a> to start tracking.
Файл properties в какой-то спринг-эм-вэ-цэ херне.
wvxvw,
01 Января 2014
-
−340
- 1
- 2
-- All scripts should begin at line
null, Null, NULL = nil
Lua
istem,
26 Ноября 2011
-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
#include <iostream>
template<typename T>
struct CrtpBase {
static float base_func()
{
std::cout << "CrtpBase::base_func(), " << typeid(T).name() << "::int_field == "
<< T::int_field << std::endl;
return 16.0f;
}
static inline float x = base_func();
};
struct A: public CrtpBase<A> {
void func_a()
{
base_func();
}
static inline int int_field = 16;
};
struct B : public CrtpBase<B> {
void func_b()
{
std::cout << "B::func_b(), no CrtpBase<B>::base_func() call" << std::endl;
}
};
int main()
{
A a;
a.func_a();
B b;
b.func_b();
}
[temp.inst]/2:
Unless a class template specialization is a declared specialization,
the class template specialization is implicitly instantiated when
the specialization is referenced in a context that requires a
completely-defined object type or when the completeness of the
class type affects the semantics of the program.
[temp.inst]/3:
The implicit instantiation of a class template specialization causes
(3.1) -- the implicit instantiation of the declarations, but not of the definitions, of
the non-deleted class member functions, member classes, scoped member enumerations,
static data members, member templates, and friends; and
(3.2) -- the implicit instantiation of the definitions of deleted member functions,
unscoped member enumerations, and member anonymous unions.
[temp.inst]/4:
Unless a member of a templated class is a declared specialization, the specialization
of the member is implicitly instantiated when the specialization is referenced in a
context that requires the member definition to exist or if the existence of the definition
of the member affects the semantics of the program; in particular, the initialization
(and any associated side effects) of a static data member does not occur unless the
static data member is itself used in a way that requires the definition of the static
data member to exist.
Таким образом, по стандарту CrtpBase<B>::x не должен быть инициализирован, поскольку он нигде не used in a way that requires the definition of the static data member to exist. Правильные компиляторы (gcc и clang) это понимают и компилируют код, а вот Visual Studio зачем-то пытается инициализировать CrtpBase<B>::x и нон-конформно ломается.
PolinaAksenova,
24 Марта 2021