Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

ITT obfuscated C and Perl

Name: Anonymous 2007-06-03 18:18 ID:phXIL2WH


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define _O );
#define O_ ((
#define O__ *

int __f(char *_, int __){for(;__;--__,O__(_+__)+=-__ _O return~(int)_;}

int main() {
char *O,_O_['\\'
|0] = "abcde"
;char _[sizeof(void*)];
O=malloc(sizeof(_O_)-1 _O memcpy(_,&
O,4 _O strcpy O_(char*O__)_)[0
],"fven"_O puts O_ char*)~
__f(*O_ char*O__)_),sizeof!
_O_)_O free(O__(char*O__)_ _O
}


post yours!

Name: Anonymous 2007-06-03 20:05 ID:Heaven

#include <stdio.h>

int main(){
 int l0;
 char*l1;
 while(!feof(stdin)){
  l1=fgetln(stdin,&l0);
  char l2[l0+1];
  memcpy(l2,l1,l0);
  if(!feof(stdin))--len;
  l2[l0]=0;
  fputs(l2,stdout);
 }
 return 0;
}

Name: Anonymous 2007-06-03 20:11 ID:Heaven

>>2
oops...
#include <stdio.h>

int main(){
 int l0;
 char*l1;
 while(!feof(stdin)){
  l1=fgetln(stdin,&l0);
  char l2[l0+1];
  memcpy(l2,l1,l0);
  if(!feof(stdin))--l0;
  l2[l0]=0;
  fputs(l2,stdout);
 }
 return 0;
}

Name: Anonymous 2007-06-03 20:49 ID:phXIL2WH

>>3
unidentified behavior in the fgetln call son..

char l2[l0+1]; // invalid, the compiler does not know the value of l0
//do char *l2=malloc(l0+1); instead

And unidentified behavior in every function call that has l1 passed.

Name: Anonymous 2007-06-03 20:54 ID:moTxXY6s

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <signal.h>
#define m(b)a=b;z=*a;while(*++a){y=*a;*a=z;z=y;}
#define h(u)G=u<<3;printf("\e[%uq",l[u])
#define c(n,s)case n:s;continue
char x[]="((((((((((((((((((((((",w[]=
"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";char r[]={92,124,47},l[]={2,3,1
,0};char*T[]={"  |","  |","%\\|/%"," %%%",""};char d=1,p=40,o=40,k=0,*a,y,z,g=
-1,G,X,**P=&T[4],f=0;unsigned int s=0;void u(int i){int n;printf(
"\233;%uH\233L%c\233;%uH%c\233;%uH%s\23322;%uH@\23323;%uH \n",*x-*w,r[d],*x+*w
,r[d],X,*P,p+=k,o);if(abs(p-x[21])>=w[21])exit(0);if(g!=G){struct itimerval t=
{0,0,0,0};g+=((g<G)<<1)-1;t.it_interval.tv_usec=t.it_value.tv_usec=72000/((g>>
3)+1);setitimer(0,&t,0);f&&printf("\e[10;%u]",g+24);}f&&putchar(7);s+=(9-w[21]
)*((g>>3)+1);o=p;m(x);m(w);(n=rand())&255||--*w||++*w;if(!(**P&&P++||n&7936)){
while(abs((X=rand()%76)-*x+2)-*w<6);++X;P=T;}(n=rand()&31)<3&&(d=n);!d&&--*x<=
*w&&(++*x,++d)||d==2&&++*x+*w>79&&(--*x,--d);signal(i,u);}void e(){signal(14,
SIG_IGN);printf("\e[0q\ecScore: %u\n",s);system("stty echo -cbreak");}int main
(int C,char**V){atexit(e);(C<2||*V[1]!=113)&&(f=(C=*(int*)getenv("TERM"))==(
int)0x756E696C||C==(int)0x6C696E75);srand(getpid());system("stty -echo cbreak"
);h(0);u(14);for(;;)switch(getchar()){case 113:return 0;case 91:case 98:c(44,k
=-1);case 32:case 110:c(46,k=0);case 93:case 109:c(47,k=1);c(49,h(0));c(50,h(1
));c(51,h(2));c(52,h(3));}}

Name: Anonymous 2007-06-03 20:58 ID:zXdR58ns

>>4
the compiler doesn't need to know the value of l0 for char l2[l0+1]; to work.
http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html

Name: Anonymous 2007-06-03 21:06 ID:phXIL2WH

>>6
hey fag, why don't you take a moment to read my post, i said use malloc(), gnu says they are dynamically allocated.
Which means gcc actually writes code that will dynamically allocate them, you get it now?

Name: Anonymous 2007-06-03 21:11 ID:Heaven

>>7
you said that char l2[l0+1]; is invalid. it is not invalid.

Name: Anonymous 2007-06-03 21:29 ID:Heaven

>>8
it's not valid c89.

Name: Anonymous 2007-06-03 21:33 ID:Heaven

>>8
plus, why anyone depend on the compiler about dynamic memory allocation? you cannot even error check the godamn thing.

char a[i]; // unidentified behavior.

Name: Anonymous 2007-06-03 21:46 ID:Heaven

>>9
C99 > C89

>>10
If your compiler is that broken, you'll probably have other problems, too.

Name: Anonymous 2007-06-03 23:01 ID:Heaven

>>1
fail c89 is widely used unlike c99.
c99 sucks shit fuck your PRIxN shit and portability issues.
and no, i don't like to depend on the compiler about essential matters.

Name: Anonymous 2007-06-04 4:36 ID:gkToZpAG

>>11
Truth

>>12
gb2/Debian stable

Name: Anonymous 2007-06-04 4:45 ID:kJ+YBe19

                 /*                                     ,*/
                #include                              <time.h>
                 #include/*                     _  ,o*/  <stdlib.h>
                 #define  c(C)/*     -      . */return      ( C); /*    2004*/
                  #include   <stdio.h>/*.   Moekan           "'   `\b-'     */
                    typedef/*  */char   p;p* u                     ,w       [9
                      ][128] ,*v;typedef  int _;_   R,i,N,I,A               ,m,o,e
                 [9],  a[256],k    [9], n[               256];FILE*f       ;_ x   (_ K,_ r
            ,_ q){;   for(;                                         r<     q    ; K       =((
         0xffffff)   &(K>>8))^                                        n[255     &        ( K
       ^u[0        +                                     r  ++      ]     )]);c          (K
      )}        _ E                           (p*r,    p*q  ){     c(          f         =
              fopen                     (r  ,q))}_   B(_ q){c(    fseek        (f,      0
            ,q))}_ D(){c(  fclose(f ))}_  C(  p    *q){c(  0-    puts(q    )   )}_/*   /
          */main(_ t,p**z){if(t<4)c(   C("<in"       "file>"    "\40<l"   "a"  "yout> "
         /*b9213272*/"<outfile>"   ) )u=0;i=I=(E(z[1],"rb")) ?B(2)?0 :   (((o   =ftell
        (f))>=8)?(u     =(p*)malloc(o))?B(0)?0:!fread(u,o,1,f):0:0)?0:  D():0      ;if(
       !u)c(C("      bad\40input  "));if(E(z[2],"rb" )){for(N=-1;256> i;n[i++] =-1   )a[
       i]=0;       for(i=I=0;   i<o&&(R  =fgetc(   f))>-1;i++)++a[R] ?(R==N)?( ++I>7)?(n[
      N]+1       )?0:(n [N   ]=i-7):0:   (N=R)    |(I=1):0;A =-1;N=o+1;for(i=33;i<127;i++
      )(        n[i   ]+  1&&N>a[i])?    N= a     [A=i]     :0;B(i=I=0);if(A+1)for(N=n[A];
     I<       8&&   (R  =fgetc(f ))>    -1&& i   <o        ;i++)(i<N||i>N+7)?(R==A)?((*w[I
     ]             =u [i])?1:(*w[I]=   46))?(a             [I++]=i):0:0:0;D();}if(I<1)c(C(
                  "  bad\40la" "yout  "))for(i            =0;256>(R=  i);n[i++]=R)for(A=8;
                 A  >0;A --)   R  = ( (R&1)==0)          ?(unsigned int)R>>(01):((unsigned
                /*kero  Q'        ,KSS  */)R>>         1)^        0xedb88320;m=a[I-1];a[I
                ]=(m           <N)?(m=   N+8):        ++        m;for(i=00;i<I;e[i++]=0){
               v=w         [i]+1;for(R                      =33;127  >R;R++)if(R-47&&R-92
               &&       R-(_)* w[i])*(                   v++)=    (p)R;*v=0;}for(sprintf
                      /*'_  G*/  (*w+1,              "%0"     "8x",x(R=time(i=0),m,o)^~
                    0)   ;i<       8;++           i)u      [N+ i]=*(*w+i+1);for(*k=x(~
                      0,i=0     ,*a);i>-        1;      ){for (A=i;A<I;A++){u[+a [ A]
                    ]=w[A       ][e[A]]  ;     k     [A+1]=x (k[A],a[A],a[A+1]
                  );}if     (R==k[I])      c(      (E(z[3  ],"wb+"))?fwrite(
                 /* */   u,o,1,f)?D          ()|C("  \n    OK."):0    :C(
                "  \n  WriteError"            ))  for  (i  =+I-
               1  ;i >-1?!w[i][++                 e[+ i]]:0;
                 ) for( A=+i--;                 A<I;e[A++]
                 =0); (i <I-4                 )?putchar
                 ((_   )  46)                  | fflush
                /*'      ,*/                  ( stdout
                ):       0&                    0;}c(C
               ("       \n                   fail")
               )      /*                    dP' /
                     dP                    pd  '
                    '                      zc
                                          */
                                         }

Name: Anonymous 2007-06-04 8:33 ID:FJ9W0IRe

gb2/Debian stable
moar liek gb2/MINIX 1.0 amirite

Name: Anonymous 2007-06-04 16:16 ID:Heaven

>>1,5,14

WHAT IS THIS ?!?!11?!

Name: Anonymous 2007-06-04 17:01 ID:SJuA5ify

>>16
compile it and find out!

Name: fhjfgh 2007-06-04 19:34 ID:LO+bR4J5

Name: Anonymous 2007-06-05 8:09 ID:RXf7sLU6

#include <stdio.h>
#define PO(o,t)\
(((o>64)&&(o<91))?(((t>96)&&(t<123))?(t-32):(t)):(((t>64)&&(t<91))?(t+32):(t))) 

      void main() {                                       char *poo= "poot",
      *Poo="pootpoot"      ,O[9];int      o,t,T,p;(t=p   =0)||(*O='\0');while
      ((o=       getc(   stdin   ))!=(   EOF))if  ((p==   0)&& (((o>64 )&& (
      o<91       )) ||   ((o>     96 )   &&(o<     123)        ))) (
      t!=8       )&&(O   [t]=     o)&&   (O[++     t] =        '\0')
      ;else {if (t>7)    {for     (T =   0 ; T     <=7;        T++ )
      printf("%c",       PO(*(   O+T),   *(Poo+   T)));       printf
      ("%c",              o);}else if     (t>3){for (T        =0;T<=
      3;T++)                                                  printf
      ("%c",                                                  PO(*(O
      +T),*(                                                  poo+T)

) ) ; printf( "%c" , o ) ; } else  printf ( "%s%c" , O , o )  ; ( t =  0 ) || (
* O =  '\0' ) ; ( o == 60 ) && ( ++p ) ; ( o == 62 ) && (p!=0) && ( --p ) ; } }

Name: Anonymous 2007-06-05 8:16 ID:RXf7sLU6

>>11,8
[ ] ANSI C
[ ] GTFO

The choice is yours

Name: Anonymous 2007-06-05 8:28 ID:Heaven

>>20
ISO > ANSI

Name: Anonymous 2007-06-05 8:39 ID:Heaven

ITT reposts of old IOCCC entries.

come on 4chan let's have something original

Name: stop postin IOCCC 2007-06-05 14:55 ID:Heaven

>>22
Well how about you give it a try instead of bitching?

Name: Anonymous 2007-06-05 15:16 ID:xnYjhgxZ

Name: Anonymous 2007-06-05 15:17 ID:Heaven

>>24
And I can't sage.

Don't change these.
Name: Email:
Entire Thread Thread List