- 1
Почему Application стал так часто падать???
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+3
Почему Application стал так часто падать???
А ещё csrf eггог-и nocTo9lHHo
0
package figury;
import java.util.Scanner;
public class figuremn {
public static void main (String[] args){
String [] monthyear = new String[12];
monthyear [1] = "Январь";
monthyear [2] = "Февраль";
monthyear [3] = "Март";
monthyear [4] = "Апрель";
monthyear [5] = "май";
monthyear [6] = "июнь";
monthyear [7] = "июль";
monthyear [8] = "август";
monthyear [9] = "сентябрь";
monthyear [10] = "октябрь";
monthyear [11] = "ноябрь";
monthyear [12] = "декабрь";
System.out.println("Введите номер месяца");
Scanner scan = new Scanner(System.in);
String x = scan.nextLine;
monthyear[]=x;
{System.out.println(x);
}
}
}
+2
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *concat(char *a, char *b)
{
char *ptr = malloc(strlen(a)+strlen(b)+6);
if (ptr == NULL)
{
fprintf(stderr, "da ty ohuel!\n");
exit(-1);
}
sprintf(ptr, "(%s)*(%s)", a, b);
return ptr;
}
char *govno[255] = {"a"};
void printfshit(const size_t pow, const char *mul_stuff)
{
printf("double pow_%zu(double a) {return %s;}\n\n", pow, mul_stuff);
}
void genshit(void)
{
//printfshit(0,"1");
size_t end_ind = 1;
size_t prev_stop = 0;
size_t end_ind_tmp = 1;
while (end_ind < 255)
{
for (size_t ind1 = 0; ind1 < end_ind_tmp; ind1++)
{
for (size_t ind2 = prev_stop; ind2 < end_ind_tmp; ind2++)
{
if (
((ind1+1) + (ind2+1) < 256) &&
(govno[(ind1+1) + (ind2+1)-1] == NULL)
)
{
govno[(ind1+1) + (ind2+1)-1] = concat(govno[ind1], govno[ind2]);
end_ind++;
}
}
}
prev_stop = end_ind_tmp;
end_ind_tmp = end_ind;
}
printfshit(1,govno[0]);
for (size_t i = 1; i < 255; i++ )
{
printfshit(i+1,govno[i]);
free(govno[i]);
}
}
int main(void)
{
genshit();
return 0;
}
Кодогенератор, написаный специально для Antervis
http://govnokod.ru/23227#comment388895
+1
CoolIntf::GetInstance().DoSomething();
CoolIntf::GetInstance().DoSomethingElse();
CoolIntf::GetInstance().DoAnything()
для случая когда GetInstance() не инлайнится, кто-нибудь в крестах какое решение (без ручного введения временной переменной) для такого кода придумал?
единственное что нашел это вот это: https://stackoverflow.com/a/2279253 .
потому что "with" слишком общее слово которое в ж не гуглится.
+2
#include <iostream>
#include <stdexcept>
using namespace std;
class Exception : std::runtime_error
{
public:
Exception( std::string const & what ) : std::runtime_error(what)
{
}
};
int main( )
{
try
{
throw Exception("Exception");
}
catch ( std::exception const & e )
{
std::cerr << e.what() << std::endl;
}
catch(...)
{
std::cerr << "..." << std::endl;
}
return 0;
}
+5
//Сегодня у меня вопрос по говнокоду.
//Как у нас на говнокодике реализовано сколько непросмотренных комментариев в каждом треде?
//Неужели на каждого юзера заводится счётчик и инкрементится при добавлении в каждой теме?
//Неужели на каждого юзера на каждый комментарий заводится флаг, сообщающий какой комментарий прочитан, а какой нет?
−1
template<typename T>
T gcd(T a, T b) {
#pragma python(gcd)
while b != 0:
a, b = b, a % b
return a
}
всех с праздником, посоны
http://codeforces.com/blog/entry/44124
+8
template <size_t capacity, bool is_signed>
class fixed_int
{
// Описание ошибки компиляции в случае использования не поддерживаемой размерности
template <int x> struct unsupported_capacity { int i[1/(x-x)]; };
template <> struct unsupported_capacity<1> {};
template <> struct unsupported_capacity<2> {};
template <> struct unsupported_capacity<4> {};
template <> struct unsupported_capacity<8> {};
// Свойства базовых типов, необходимые для перебора
template<typename type> struct type_traits;
template<> struct type_traits <unsigned char> { typedef unsigned char current_type; typedef unsigned short next_type; };
template<> struct type_traits <unsigned short> { typedef unsigned short current_type; typedef unsigned int next_type; };
template<> struct type_traits <unsigned int> { typedef unsigned int current_type; typedef unsigned long next_type; };
template<> struct type_traits <unsigned long> { typedef unsigned long current_type; typedef unsigned long long next_type; };
template<> struct type_traits <unsigned long long int> { typedef unsigned long long int current_type; typedef unsupported_capacity<capacity> next_type; };
template<> struct type_traits <signed char> { typedef signed char current_type; typedef short next_type; };
template<> struct type_traits <short> { typedef short current_type; typedef int next_type; };
template<> struct type_traits <int> { typedef int current_type; typedef long next_type; };
template<> struct type_traits <long> { typedef long current_type; typedef long long next_type; };
template<> struct type_traits <long long int> { typedef long long int current_type; typedef unsupported_capacity<capacity> next_type;};
// Алгоритм выбора типа
template<typename type, bool>
struct type_choice
{
typedef typename type_traits<type>::current_type std_type;
};
template<typename type>
struct type_choice<type, false>
{
typedef typename type_traits<type>::next_type next_type;
typedef typename type_choice<next_type, sizeof(next_type) == capacity>::std_type std_type;
};
// Базовый тип для начала подбора
template <bool is_signed> struct base_type_selector { typedef signed char base_type; };
template <> struct base_type_selector<false> { typedef unsigned char base_type; };
public:
typedef typename type_choice< typename base_type_selector<is_signed>::base_type, sizeof(base_type_selector<is_signed>::base_type) == capacity >::std_type type;
};
"Зачем мне нужен stdint.h?
У меня нет времени, чтобы ебаться с ним!
Лучше я высру ещё десяток-другой шаблонов!"
https://habrahabr.ru/post/280542/
PS,
Пятая строка - вообще угар.
+2
const int MOD = 1000000007;
int pow(int a, int b) {
if (!b) return 1;
if (b & 1) return (pow(a, b - 1) * 1LL * a) % MOD;
return pow((a * 1LL * a) % MOD, b / 2);
}
http://ideone.com/JlfNxZ
Там ещё куча всякого говна есть
http://acm.math.spbu.ru/~kunyavskiy/cpp/
+76
.global shit
.type shit, @function
shit:
/* prologue: function */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
mov r30,r24
mov r31,r25
ldd r18,Z+1
ldd r22,Z+2
mov r24,r22
ldi r25,0
ldi r26,0
ldi r27,0
mov r26,r24
mov r27,r25
clr r25
clr r24
or r25,r18
ld r18,Z
or r24,r18
ldd r18,Z+3
mov r22,r24
mov r23,r25
mov r24,r26
mov r25,r27
or r25,r18
ret
.size shit, .-shit
Вот такое ГЛОБАЛЬНОЕ ГОВНО мне делает GCC под AVR
Код разворота байтиков:
unsigned long int shit(unsigned char *a)
{
return
( unsigned long int)a[0] << 0 |
((unsigned long int)a[1] << 8 ) |
((unsigned long int)a[2] << 16) |
((unsigned long int)a[3] << 24);
}#if defined (L_bswapsi2)
;; swap bytes
;; r25:r22 = bswap32 (r25:r22)
DEFUN __bswapsi2
bswap r22, r25
bswap r23, r24
ret
ENDF __bswapsi2
#endif /* defined (L_bswapsi2) */