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: Wed, 27 Feb 2019 22:37:49 -0800 Organization: None to speak of Lines: 56 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="26815"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/95ax40fC1shUAz292aojb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:SaV3HZq8iza+5FqFrOlCrARB1sU= sha1:lgOvdqznC9WPJ+m3E8CooH7GnZY= Xref: csiph.com comp.lang.c:141488 comp.programming:9797 [Dropped extraneous newsgroups] Ahem A Rivet's Shot writes: > On Mon, 25 Feb 2019 12:29:38 +0000 > Richard Heathfield wrote: > >> Which is the saving grace of Piet. Piet programs can be rather attractive. > > This program is pretty ... > > #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. 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 */