Uri Goren
goren.uri@gmail.com
make goren
echo "some text" | ./goren
echo "Hello, world!" | ./goren
In the words of René François Ghislain Magritte Magritte:
One may ask the surrealist question:
echo 'If | is just a representation of a pipe, then how can data stuff it?' | ./goren
However if one takes a firm stand and declares:
echo '| is just a representation of a pipe because I say so! So stuff it!' | ./goren
something happens! Why?
This program was written in homage to Rene Magritte’s picture “La trahison des images” (The Treachery of Images).
In order to show my unconditional admiration of this work, I avoided using conditions.
In this work, Magritte points out that a picture of a pipe is not a pipe. But what IS a pipe? This program tries to provide an answer.
Magritte’s [test for pipes](http://en.wikipedia.org/wiki/The_Treachery_of_Images} is:
The famous pipe. How people reproached me for it! And yet, could
you stuff my pipe? No, it's just a representation, is it not?
Accordingly, this program only approves pipes which can be used for stuffing data.
One thing I tried to achieve is condition free programming. Many have noted that conditions make the code harder to read and understand. A good example would be:
Brent Burley’s 2004 IOCCC winner
That entry omits conditional statements such as “if” and “while”. His achievement in improving clarity by omitting conditions is impressive, but I think it can be taken further, in two ways.
First, conditional operators, such as ?:, && and ||, can be thrown away. Second, using setjmp and longjmp, which are unfortunately not in common use, might make it difficult for a novice programmer to understnad the code without referring to the man page.
By removing these, the code is 100% condition free, and every function runs its instructions in perfect order. Naturally, this makes the program flow trivial to understand. This can be verified by disassembling the compiled code and looking for conditional jumps (when compiled with gcc on x86, there are none).
The program should compile with any C compiler, but was tested mostly with gcc on Linux.
It doesn’t support 64 bits (due to integer-pointer casts, and a >>31). It does work on 64-bit Linux, becasue all functions are below 4GB.
© Copyright 1984-2012,
Leo Broukhis, Simon Cooper, Landon Curt Noll
- All rights reserved |