- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
void Sender::exceptionHandler()
{
try
{
throw;
}
catch (std::exception& ex)
{
Log::write(ex);
}
catch (...)
{
Log::write("I am CraZzY!");
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+48
void Sender::exceptionHandler()
{
try
{
throw;
}
catch (std::exception& ex)
{
Log::write(ex);
}
catch (...)
{
Log::write("I am CraZzY!");
+53
for (int i = 1; i <= s.Length; ++i) {
if (s[i] == '/') {
s = s.SubString(1, i) + s.SubString(i, MaxInt);
++i;
}
}
Кручу-верчу запутать хочу. Кто с первого раза догадается, в чём задача кода - получит пирожок с полочки.
P.S. Строки билдеровские, нумерация с 1. SubString принимает индекс начала и количество символов.
+65
std::string Operations::getLastError()
{
return "Произошла неизвестная ошибка при выполнении криптооперации";
}
+67
catch (...)
{
return -__LINE__;
}
+143
int n;
cin >> n;
int nums[n];
for (int i = 0; i < n; i++)
nums[i] = pow(i + 1, 2);
Немного эзотерики.
nums[4] = 24
+51
static bool convertCharToHexByte(char& ch)
{
if (ch >= '0' && ch <= '9') {
ch -= '0';
return true;
}
if (ch >= 'a' && ch <= 'f') {
ch -= 'a';
ch += 0xA;
return true;
}
if (ch >= 'A' && ch <= 'F') {
ch -= 'A';
ch += 0xA;
return true;
}
return false;
}
+54
_defaultLog
#include "stdafx.h"
Это первые две строчки в C++ файле. Сам файл включен файл проекта. Ошибок компиляции нет. Сегодня удалю эту первую строку. В комментариях к комиту с этим изменением в свн написано: "Исправление дидлока".
+141
strcat(strcpy(malloc(strlen(argv[0]) + sizeof(".track")), argv[0]), ".track")
+50
if ( !log.append(log_line) )
log.append("Can't append to log");
+54
// We now have a locale string, but the global locale can be changed by
// another thread. If we allow this thread's locale to be updated before we're done
// with this string, it might be freed from under us.
// Call versions of the wide-to-MB-char conversions that do not update the current thread's
// locale.
//...
/*
* Note that we are using a risky trick here. We are adding this
* locale to an existing threadlocinfo struct, and thus starting
* the locale's refcount with the same value as the whole struct.
* That means all code which modifies both threadlocinfo::refcount
* and threadlocinfo::lc_category[]::refcount in structs that are
* potentially shared across threads must make those modifications
* under _SETLOCALE_LOCK. Otherwise, there's a race condition
* for some other thread modifying threadlocinfo::refcount after
* we load it but before we store it to refcount.
*/
MS VS 2013 CRT