On 27 Nov 2010, at 18:16, Marcel Kilgus wrote:

> Norman Dunbar wrote:
>> Main() always returns int.
> 
> True.
> 
>> Main always takes two parameters int and char **.
> 
> Not true, "int main(void)" is valid according to C99 spec (see chapter 
> 5.1.2.2.1 ;-) )
> 
> But in context of the IOCC contest Tobias referred to, basically
> everything that compiles is valid (his example doesn't really work in
> any case). Though they're usually much worse, this for example is an
> actual winning entry from 1988:
> 
> main(t,_,a)
> char *a;
> {return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
> main(-86, 0, a+1 )+a)):1,t<_?main(t+1, _, a ):3,main ( -94, -27+t, a
> )&&t == 2 ?_<13 ?main ( 2, _+1, "%s %d %d\n" ):9:16:t<0?t<-72?main(_,
> t,"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+\
> ,/+#n+,/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/\
> +k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){n\
> l]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
> n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
> ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\
> #'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
> :t<-50?_==*a ?putchar(a[31]):main(-65,_,a+1):main((*a == '/')+t,_,a\
> +1 ):0<t?main ( 2, 2 , "%s"):*a=='/'||main(0,main(-61,*a, "!ek;dc \
> i...@bk'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}
> 


Another 1988 winning entry was as follows according to Peter van der Linden.

#include<stdio.h>
#include<ctype.h>
#define w printf
#define p while
#define t(s) (W=T(s))
char*X,*B,*L,I[99];M,W,V;D() {W==9?(w("`%.*s' is ",V,X),t(0):W==40?
(t(0),D(),t(41)):W==42?(t(0),D(),w("ptr to ")):0;p(W==40?(t(0),
w("func returning "),t(41)):W==91?(t(0)==32?(w("array[0..%d]  of  ",
atoi(X)-1),t(0):w("array of  "),t(93)):0);}main(){p(w("input:  "),
B=gets(I))if(t(0)==9)L=X,M=V,t(0),D(),w("%.*s.\n\n",M,L);}T(s){if(!s||s==W)
{p(*B==9||*B==32)B++;X=B;V=0;if(W=isalpha(*B)?9:isdigit(*B)?32:*B++)
if(W<33)p(isalnum(*B))B++,V++;}return W;} 

This translates C declarations into English.

The programmer was Gopi Reddy.

George
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to