Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c,comp.programming Subject: Re: C is not a low level language Date: Thu, 28 Feb 2019 02:25:58 -0800 Organization: None to speak of Lines: 51 Message-ID: References: <20190224075627.3004ea1cebad8b4055574d17@eircom.net> <7qm47e99prt8o5ga9phi6mofn72ek248i2@4ax.com> <60mckf-teg.ln1@gangtai.home.grep.be> <20190225142618.6663a9845e7fe4eb9c60ad89@eircom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="740125203046c87687fac1b57b8ff8cc"; logging-data="4935"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19MoD+CVwkZLQFGy3DLfshT" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Rb6UsDyH6OsL1JwWkyS3Zc9xDzo= sha1:K5syCZsBeud0g7F6Xtx/QmbAiFU= Xref: csiph.com comp.lang.c:141489 comp.programming:9798 Keith Thompson writes: [...] >> #define _ -F<00||--F-OO--; >> int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() >> { >> _-_-_-_ >> _-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_-_-_-_-_ >> _-_-_-_-_-_-_-_ >> _-_-_-_ >> } >> >> >> ... but far from readable. > > That program is from the 1989 IOCCC (International Obfuscated C Code > Contest). It doesn't produce the expected result because it makes an > assumption about the behavior of the C preprocessor. Correction: 1988. > Changing the #define line to > > #define _ F-->00||F-OO--; > > fixes the problem. (It still produces some warnings, and strictly > speaking has undefined behavior, fixable by updating adding an #include > directive and updating the function declarations.) > > With this change, the output is > > 3.141 > > https://ioccc.org/1988/westley.c > https://ioccc.org/1988/westley.hint -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */