- 1
- 2
- 3
- 4
#pragma aux __cdecl "_*" \
parm caller [ ] \
value struct float struct routine [eax] \
modify [eax ecx edx]
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
#pragma aux __cdecl "_*" \
parm caller [ ] \
value struct float struct routine [eax] \
modify [eax ecx edx]
+1
#include <stdio.h>
int main(void)
{
(
*********************
** ** ** ***** *
* ** * **** ** *** **
* ** * **** *** * ***
* ** * **** **** ****
* ** * **** *** * ***
* ** ** *** *** **
*********************
printf)("pidor");
}
+1
static char *cast_table[][11] = {
// i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 f80
{NULL, NULL, NULL, i32i64, i32u8, i32u16, NULL, i32i64, i32f32, i32f64, i32f80}, // i8
{i32i8, NULL, NULL, i32i64, i32u8, i32u16, NULL, i32i64, i32f32, i32f64, i32f80}, // i16
{i32i8, i32i16, NULL, i32i64, i32u8, i32u16, NULL, i32i64, i32f32, i32f64, i32f80}, // i32
{i32i8, i32i16, NULL, NULL, i32u8, i32u16, NULL, NULL, i64f32, i64f64, i64f80}, // i64
{i32i8, NULL, NULL, i32i64, NULL, NULL, NULL, i32i64, i32f32, i32f64, i32f80}, // u8
{i32i8, i32i16, NULL, i32i64, i32u8, NULL, NULL, i32i64, i32f32, i32f64, i32f80}, // u16
{i32i8, i32i16, NULL, u32i64, i32u8, i32u16, NULL, u32i64, u32f32, u32f64, u32f80}, // u32
{i32i8, i32i16, NULL, NULL, i32u8, i32u16, NULL, NULL, u64f32, u64f64, u64f80}, // u64
{f32i8, f32i16, f32i32, f32i64, f32u8, f32u16, f32u32, f32u64, NULL, f32f64, f32f80}, // f32
{f64i8, f64i16, f64i32, f64i64, f64u8, f64u16, f64u32, f64u64, f64f32, NULL, f64f80}, // f64
{f80i8, f80i16, f80i32, f80i64, f80u8, f80u16, f80u32, f80u64, f80f32, f80f64, NULL}, // f80
};
красивое
0
// Takes a printf-style format string and returns a formatted string.
char *format(char *fmt, ...) {
char *buf;
size_t buflen;
FILE *out = open_memstream(&buf, &buflen);
va_list ap;
va_start(ap, fmt);
vfprintf(out, fmt, ap);
va_end(ap);
fclose(out);
return buf;
}
−1
typedef enum {
FILE_NONE, FILE_C, FILE_ASM, FILE_OBJ, FILE_AR, FILE_DSO,
} FileType;
StringArray include_paths;
bool opt_fcommon = true;
bool opt_fpic;
static FileType opt_x;
static StringArray opt_include;
static bool opt_E;
static bool opt_M;
static bool opt_MD;
static bool opt_MMD;
static bool opt_MP;
static bool opt_S;
static bool opt_c;
static bool opt_cc1;
static bool opt_hash_hash_hash;
static bool opt_static;
static bool opt_shared;
static char *opt_MF;
static char *opt_MT;
static char *opt_o;
static StringArray ld_extra_args;
static StringArray std_include_paths;
char *base_file;
static char *output_file;
static StringArray input_paths;
static StringArray tmpfiles;
благо поиск по проекту работает
0
void pong_game(void)
{
/*Set the first random direction the ball will be traviling*/
direction=random_direction();
/*Play the game while the ESC key is not pressed*/
while(!key[KEY_ESC]) {
/*Move the Ball*/
move_ball();
/*Respond to the input*/
key_respond();
/*Put the information on the Screen*/
textout(buffer,pong_datafile[pong_text].dat,"Player 1 Score:",
150,0,254);
textout(buffer,pong_datafile[pong_text].dat,itoa(score_p1,NULL,10),
text_length(pong_datafile[pong_text].dat,
"Player 1 Score:")+150,0,10);
textout(buffer,pong_datafile[pong_text].dat,"Player 2 Score:",
350,0,254);
textout(buffer,pong_datafile[pong_text].dat,itoa(score_p2,NULL,10),
text_length(pong_datafile[pong_text].dat,
"Player 2 Score:")+350,0,10);
textout(buffer,pong_datafile[pong_text].dat,"keyboard",0,0,255);
textout(buffer,pong_datafile[pong_text].dat,"joystick",
640-text_length(pong_datafile[pong_text].dat,"joystick"),
0,255);
/*Draw a line to set the boundries*/
line(buffer,0,30,640,30,10);
/*Put the buffer screen on the screen*/
blit(buffer,screen,0,0,0,0,640,480);
/*Clear the buffer*/
clear(buffer);
}
return;
}
помните?
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))
0
#include <stdio.h>
#include <setjmp.h>
#include <assert.h>
jmp_buf ebuf;
void f2(void)
{
longjmp(ebuf, (int)"kokoko");
}
int main(void)
{
const char* i;
printf("petuhi ");
i = (const char*)setjmp(ebuf);
if (!i)
{
f2();
printf ("moo ");
}
printf("%s\n", i);
return 0;
}
можно елду сделать
0
// https://sources.debian.org/src/bsdiff/4.3-23/bsdiff.c/#L57
static void split(t_off *I,t_off *V,t_off start,t_off len,t_off h)
{
t_off i,j,k,x,tmp,jj,kk;
if(len<16) {
for(k=start;k<start+len;k+=j) {
j=1;x=V[I[k]+h];
for(i=1;k+i<start+len;i++) {
if(V[I[k+i]+h]<x) {
x=V[I[k+i]+h];
j=0;
};
if(V[I[k+i]+h]==x) {
tmp=I[k+j];I[k+j]=I[k+i];I[k+i]=tmp;
j++;
};
};
for(i=0;i<j;i++) V[I[k+i]]=k+j-1;
if(j==1) I[k]=-1;
};
return;
};
x=V[I[start+len/2]+h];
jj=0;kk=0;
for(i=start;i<start+len;i++) {
if(V[I[i]+h]<x) jj++;
if(V[I[i]+h]==x) kk++;
};
jj+=start;kk+=jj;
i=start;j=0;k=0;
while(i<jj) {
if(V[I[i]+h]<x) {
i++;
} else if(V[I[i]+h]==x) {
tmp=I[i];I[i]=I[jj+j];I[jj+j]=tmp;
j++;
} else {
tmp=I[i];I[i]=I[kk+k];I[kk+k]=tmp;
k++;
};
};
while(jj+j<kk) {
if(V[I[jj+j]+h]==x) {
j++;
} else {
tmp=I[jj+j];I[jj+j]=I[kk+k];I[kk+k]=tmp;
k++;
};
};
if(jj>start) split(I,V,start,jj-start,h);
for(i=0;i<kk-jj;i++) V[I[jj+i]]=kk-1;
if(jj==kk-1) I[jj]=-1;
if(start+len>kk) split(I,V,kk,start+len-kk,h);
}
static void qsufsort(t_off *I,t_off *V,u_char *old,t_off oldsize)
{
t_off buckets[256];
t_off i,h,len;
for(i=0;i<256;i++) buckets[i]=0;
for(i=0;i<oldsize;i++) buckets[old[i]]++;
for(i=1;i<256;i++) buckets[i]+=buckets[i-1];
for(i=255;i>0;i--) buckets[i]=buckets[i-1];
buckets[0]=0;
for(i=0;i<oldsize;i++) I[++buckets[old[i]]]=i;
I[0]=oldsize;
for(i=0;i<oldsize;i++) V[i]=buckets[old[i]];
V[oldsize]=0;
for(i=1;i<256;i++) if(buckets[i]==buckets[i-1]+1) I[buckets[i]]=-1;
I[0]=-1;
for(h=1;I[0]!=-(oldsize+1);h+=h) {
len=0;
for(i=0;i<oldsize+1;) {
if(I[i]<0) {
len-=I[i];
i-=I[i];
} else {
if(len) I[i-len]=-len;
len=V[I[i]]+1-i;
split(I,V,i,len,h);
i+=len;
len=0;
};
};
if(len) I[i-len]=-len;
};
for(i=0;i<oldsize+1;i++) I[V[i]]=i;
}
Исходник "bsdiff"
0
int main(int argc, char **argv) {
void *vp;
const char *version_str;
if (argc != 2) {
fprintf(stderr, "usage: %s <version>\n", argv[0]);
exit(1);
}
vp = malloc(strlen(argv[1]) + 1);
strcpy(vp, argv[1]);
version_str = check_header(vp);
free(vp);
printf("0.%s\n", version_str);
return 0;
}
Там Беллард с научил вореции программировать на Сишке
https://textsynth.com/playground.html