Author:
To build:
make
To use:
echo "some text" | ./goren
Try:
./try.sh
Judges’ remarks:
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?
Author’s remarks:
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 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 winning 2004/burley entry.
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(3)
and longjmp(3)
, which are unfortunately not in
common use, might make it difficult for a novice programmer to understand 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).
Compatibility:
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, because all functions are below 4GB.
Inventory for 2011/goren
Primary files
- goren.c - entry source code
- Makefile - entry Makefile
- goren.orig.c - original source code
- MagrittePipe.jpg - this is not a pipe image
- try.sh - script to try entry
Secondary files
- 2011_goren.tar.bz2 - download entry tarball
- README.md - markdown source for this web page
- .entry.json - entry summary and manifest in JSON
- .gitignore - list of files that should not be committed under git
- .path - directory path from top level directory
- index.html - this web page