|
From: Jason H. <jas...@nt...> - 2002-05-24 03:27:56
|
Actualy it is C++ code, or I should say C code. A line of code doesn't actualy have to be all on one
line, the compiler makes no distinction between the different kinds of whitespace between the C/C++
tokens (the syntaxically seperate elements), i.e. tab, space, carriage-return, or multiples of them.
So you can write:
char *c = "hello world!";
or:
char
*
c
=
"hello world"
;
That is mainly what is happening below.
Another reason it's so unreadable, apart from the bad formatting, is that the names of variables and
functions are single letters, either lowercase or uppercase, which is a good argument to use
descriptive names in a program.
There is a lot of use of the comma operator, and with a comma operator you can string together a
group of commands into a statement, but that statement evaluates to the value after the rightmost,
last, comma. i.e.
int c = 10, 20, 30, "40", 50;
Such that int 'c' in fact equals 50. The other elements are still evaluated, but the values they
return are discarded. None of the other elements in that comma seperated list have any side effects,
but you can do that too:
int c = p++, (a = a + b), 30, "Hello world", 50;
The c variable still equals 50, but along with that p has been incremented, and a has been changed
to a+b.
At the top is a series of global declarations; a string, a two dimensional array of char, a pointer
to a char, a char, etc....
Followed by 10 functions and main. All the functions have no specified return value, but they do
modify the global variables in specific ways. There is also a gets() and a putchar() function call
involved, which means at some point the program expects input and will produce output.
I've gone through the program and broken it into syntaxically readable code, although there is still
a lot of superfluos code in there and I doubt I've done it perfectly. I've attached the file, rather
than displaying it below as e-mail clients don't make normal code all that readable anyway.
Maybe when I have some time I will go through it and identify the parts that are superflous and
break the code up into seperated statements, and not comma'd lists. Then we'd be able to read what
is does properly. It's an interesting challenge.
I hope this helps, Jason.
----- Original Message -----
From: Daniel Wilches
To: DEV-C++
Sent: Friday, May 24, 2002 2:40 AM
Subject: [Dev-C++] Un cpp muy raro
Hola a todos!!
Hi everybody!!
Can anyone tell me how is that the following program can be compiled, it isnt C++ code, it looks
like weird characters but if you compile them there is no error.
Please Anyone tell me, thanx
(Quien puede decirme como funciona esta cosa tan rara hecha en C++??
Se que parecen caracteres incoherentes pero metanlos en un archivo, compilenlo y vean:)
*****Here begin the program: (Aqui comienza el programa)
#include <stdio.h>
char
*T="IeJKLMaYQCE]jbZRskc[SldU^V\\X\\|/_<[<:90!\"$434-./2>]s",
K[3][1000],*F,x,A,*M[2],*J,r[4],*g,N,Y,*Q,W,*k,q,D;X(){r [r
[r[3]=M[1-(x&1)][*r=W,1],2]=*Q+2,1]=x+1+Y,*g++=((((x& 7)
-1)>>1)-1)?*r:r[x>>3],(++x<*r)&&X();}E(){A||X(x=0,g =J
),x=7&(*T>>A*3),J[(x[F]-W-x)^A*7]=Q[x&3]^A*(*M)[2 +(
x&1)],g=J+((x[k]-W)^A*7)-A,g[1]=(*M)[*g=M[T+=A ,1
][x&1],x&1],(A^=1)&&(E(),J+=W);}l(){E(--q&&l ()
);}B(){*J&&B((D=*J,Q[2]<D&&D<k[1]&&(*g++=1 ),
!(D-W&&D-9&&D-10&&D-13)&&(!*r&&(*g++=0) ,*
r=1)||64<D&&D<91&&(*r=0,*g++=D-63)||D >=
97&&D<123&&(*r=0,*g++=D-95)||!(D-k[ 3]
)&&(*r=0,*g++=12)||D>k[3]&&D<=k[ 1]
-1&&(*r=0,*g++=D-47),J++));}j( ){
putchar(A);}b(){(j(A=(*K)[D* W+
r[2]*Y+x]),++x<Y)&&b();}t ()
{(j((b(D=q[g],x=0),A=W) ),
++q<(*(r+1)<Y?*(r+1): Y)
)&&t();}R(){(A=(t( q=
0),'\n'),j(),++r [2
]<N)&&R();}O() {(
j((r[2]=0,R( ))
),r[1]-=q) &&
O(g-=-q) ;}
C(){( J=
gets (K
[1]))&&C((B(g=K[2]),*r=!(!*r&&(*g++=0)),(*r)[r]=g-K[2],g=K[2
],r[
1]&&
O())
);;}
main
(){C
((l(
(J=(
A=0)
[K],
A[M]
=(F=
(k=(
M[!A
]=(Q
=T+(
q=(Y
=(W=
32)-
(N=4
))))
+N)+
2)+7
)+7)
),Y=
N<<(
*r=!
-A))
);;}
**** Here ends (Aqui acaba el programa)
HOW this compile, ehh??
NO entiendo como es que se puede ejecutar lo anterior si no es codigo en C++
GRACIAS
Daniel Wilches
d_w...@ho...
|