- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
void f(bool *ok = 0)
{
//тут возникла ошибка
if (ok)
*ok = false;
return;
}
//далее в коде
bool ok = false;
f(&ok);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+62
void f(bool *ok = 0)
{
//тут возникла ошибка
if (ok)
*ok = false;
return;
}
//далее в коде
bool ok = false;
f(&ok);
не, ну заебок, чо
+51
#if defined(alignas) /* check C++ keywords */ \
|| defined(alignof) \
|| defined(asm) \
|| defined(auto) \
|| defined(bool) \
<...snip...>
|| defined(virtual) \
|| defined(void) \
|| defined(volatile) \
|| defined(wchar_t) \
|| defined(while)
#error keyword defined before including C++ standard header
#endif /* defined... */
Из заголовочных файлов VS 2012.
http://www.viva64.com/en/b/0146/
−113
user8@linux ~ $ python
Python 2.7.5 (default, Feb 10 2014, 02:34:23)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> 1-3*(math.exp(1)-2)/math.exp(1)
0.207276647028654
>>> 1-4*(1-3*(math.exp(1)-2)/math.exp(1))
0.17089341188538398
>>> 1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1)))
0.14553294057308008
>>> 1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1))))
0.1268023565615195
>>> 1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1)))))
0.11238350406936348
>>> 1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1))))))
0.10093196744509214
>>> 1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1)))))))
0.09161229299417073
>>> 1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1))))))))
0.0838770700582927
>>> 1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1)))))))))
0.07735222935878028
>>> 1-12*(1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1))))))))))
0.07177324769463667
>>> 1-13*(1-12*(1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1)))))))))))
0.06694777996972334
>>> 1-14*(1-13*(1-12*(1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1))))))))))))
0.06273108042387321
>>> 1-15*(1-14*(1-13*(1-12*(1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1)))))))))))))
0.059033793641901866
>>> 1-16*(1-15*(1-14*(1-13*(1-12*(1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1))))))))))))))
0.05545930172957014
>>> 1-17*(1-16*(1-15*(1-14*(1-13*(1-12*(1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1)))))))))))))))
0.05719187059730757
>>> 1-18*(1-17*(1-16*(1-15*(1-14*(1-13*(1-12*(1-11*(1-10*(1-9*(1-8*(1-7*(1 - 6*(1 - 5*(1-4*(1-3*(math.exp(1)-2)/math.exp(1))))))))))))))))
-0.029453670751536265
Дано рекуррентное соотношение: x 1 = 1 e , x k = 1 − kx k−1 , k = 2, 3, 4, . . .
Напишите программу, которая вычисляет первые 15 чисел с точностью float и выводит их на экран
−121
If ((ind_imit_gun = 0) And _
((input_B_LA2 And shop) = shop) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And lonely) = lonely) And _
(input_A_LA48 And choice_k) = choice_k) _
Or ((ind_imit_gun = 0) And _
((input_B_LA2 And shop) = shop) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And mashin) = mashin) And _
(input_A_LA48 And choice_k) = choice_k) _
Or ((ind_imit_gun = 1) And _
((input_B_LA2 And shop) = shop) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And lonely) = lonely) And _
(input_A_LA48 And choice_k) = choice_k) _
Or ((ind_imit_gun = 2) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And lonely) = lonely) And _
(input_A_LA48 And choice_k) = choice_k) _
Or ((ind_imit_gun = 2) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And mashin) = mashin) And _
(input_A_LA48 And choice_k) = choice_k) _
Or ((ind_imit_gun = 3) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And mashin) = mashin) And _
(input_A_LA48 And choice_k) = choice_k) _
Or ((ind_imit_gun = 4) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And lonely) = lonely) And _
(input_A_LA48 And choice_k) = choice_k) _
Or ((ind_imit_gun = 6) And _
((input_B_LA2 And loading) = loading) And _
((input_B_LA2 And lonely) = lonely) And _
(input_A_LA48 And choice_k) = choice_k) Then
Вот такая страшная проверка нужных битов битовыми масками используется в одном военном ПО xD
И на мой взгляд тут есть ошибки,но почему то работает.
+157
<?php
class smth {
protected static $MARK_UNDEFINED = 'Undefined';
protected static $MARK_F = 'ECTS-F';
protected static $MARK_FX = 'ECTS-FX';
protected static $MARK_E = 'ECTS-E';
protected static $MARK_D = 'ECTS-D';
protected static $MARK_C = 'ECTS-C';
protected static $MARK_B = 'ECTS-B';
protected static $MARK_A = 'ECTS-A';
protected function getECTSMark($rate, $current, $examRate)
{
$color = self::$MARK_UNDEFINED;
if ($current > 0) {
$percent = $rate / $current;
if ($examRate !== NULL AND $examRate < 22)
$color = self::$MARK_FX;
elseif ($percent < 0.31)
$color = self::$MARK_F;
elseif ($percent < 0.60)
$color = self::$MARK_FX;
elseif ($percent < 0.65)
$color = self::$MARK_E;
elseif ($percent < 0.71)
$color = self::$MARK_D;
elseif ($percent < 0.85)
$color = self::$MARK_C;
elseif ($percent < 0.95)
$color = self::$MARK_B;
else
$color = self::$MARK_A;
}
return $color;
}
}
Сижу и думаю, как это вообще можно как-то.. отговнокодить? О_о
+145
###
CoffeeScript
Give a fuck
###
while fuck isnt given
do give_a_fuck until orgasm
+51
#include <ppl.h>
#include <windows.h>
#include <ppltasks.h>
#include <iostream>
#include <vector>
using namespace Concurrency;
using namespace std;
CRITICAL_SECTION cs6;
int main(int argc, char* argv[])
{
size_t concurentThreadsSupported = std::thread::hardware_concurrency();
cout << concurentThreadsSupported << endl;
//deadlock hazard increased with concurentThreadsSupported decreasing
size_t taskAmountForWasteVirtualCores = concurentThreadsSupported - 1;//must be equal to (virtual processor thread amount from Concurrency::IResourceManager) - 1
vector<task<void>> t;
for (size_t i = 0; i<taskAmountForWasteVirtualCores; ++i)
t.push_back(create_task([]{
Sleep(INFINITE);//some very long IO operation or deadlocked by EnterCriticalSection or sql transaction or other
}));
Sleep(1000);
cout << "another way:" << endl;
InitializeCriticalSection(&cs6);
auto locker = create_task([]{
cout << "locker" << endl;
EnterCriticalSection(&cs6);//same as begin sql transaction
cout << "locker entered cs 6" << endl;
Concurrency::wait(500);//Deadlock by any concurrency context switching directly or indirectly by std or MFC (events, mutex, etc)
cout << "locker played" << endl;
LeaveCriticalSection(&cs6);//same as end sql transaction
cout << "~locker ok" << endl;
});
auto locked = create_task([]{
cout << "locked" << endl;
EnterCriticalSection(&cs6);//same as begin sql transaction
cout << "locked entered cs 6" << endl;
Concurrency::wait(500);
cout << "locked played" << endl;
LeaveCriticalSection(&cs6);//same as end sql transaction
cout << "~locked ok" << endl;
});
Sleep(1000);
cout << "FAIL" << endl;
return 0;
}
Нашел дидлок)
http://rextester.com/KHC72232
http://rextester.com/EMG65441
+170
public function action_ajaxlogin()
{
// Если запрос поступил не через AJAX, то шлем нахуй
if ( ! $this->request->is_ajax())
{
throw new HTTP_Exception_404(NULL);
}
// Вырубаем авто-рендер, ибо это хуев аякс запрос
$this->auto_render = false;
// Собираем информацию и пользователе в ёбанный массив
$user_data = $this->request->post('user_data');
// Если пользователь авторизирован, то заебато, и возвращаем статус 200!
if (Auth::instance()->login($user_data['username'], $user_data['password'], (bool) isset($user_data['remember_me'])))
return $this->response->status(200);
// Если нет, то "Вася, все хуйня! Давай по новой!"
return $this->response->status(400);
}
public function action_logout()
{
// Если запрос поступил не через AJAX, то шлем нахуй
if ( ! $this->request->is_ajax())
{
throw new HTTP_Exception_404(NULL);
}
// Вырубаем сучий авто-рендер, нахуй, в пизду блядь
$this->auto_render = false;
// Выходим из аккаунта, если вышли, то ахуенно, 200-ый статус)
if (Auth::instance()->logout())
return $this->response->status(200);
// Если все хуйня, то "Вася, давай по новой!"
return $this->response->status(400);
}
Kohana фреймворк, и таких комментариев по проекту тьма :)
+155
logs.splice.apply(logs, [j, 1].concat(line.split("\n")));
+168
generator=function(a,q){m=Math;no='';nb=' ';
rnd=function(r,w){return((m.round(((+new Date)*m.random())%r)||0)+(w||0));};
ff=function(ff){ma=function(ma1,ma2){return(m.max(ma1,ma2));};return(ma(ma(rnd(rnd(ff)),rnd(rnd(ff))),ma(rnd(rnd(ff)),rnd(rnd(ff)))));};
sumb=function(x,y){return(String.fromCharCode(rnd(m.abs((y||1)-1),m.abs(x||32))));};
sor=function(o){return(o.sort(function(){return(0.5-m.random())}));};
a=Number(a||0);
q=q||[];
q=function(z){r=0;for(j=0;j<z.length;j++){r+=z[j]};return(r);}(q)?q:(Array(4+4+4+4+4+4+4+4
+4+4+4 +4+4+4
+1).join('1').split(no));sx=function(p,u){g=q.length;return(Number(q[p>g?g:p])?u:no);};len=Array();for(r=0;r<rnd(a,a*5);r++){e=[
sumb(958)
,sumb(97,26)
,sumb(945,25)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(945,25)
,sumb(97,26)
,sumb(945,25)
,sumb(97,26)
,sumb(945,25)
,sumb(97,26)
,sumb(945,25)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(97,26)
,sumb(223)
,sumb(228)
,sumb(230)
,sumb(231)
,sumb(239)
,sumb(240)
,sumb(241)
,sumb(235)
,sumb(246)
И это было написано ручками, не использовался никакой uglify
И этот проект мне достался в наследство на новой работе.
КМП.