Add 1989/robison/try.sh
Also updated bugs.md with another case where the program might 'break into tiny bits' but as a feature not a bug. Checking the source code will give all you need to know about the 'problem' quite well.
This commit is contained in:
1 parent
4238aac1ac
commit
3267c2e625
4 files changed
+52
-16
No files matched your search
+6
-16
@@ -29,27 +29,17 @@ For more detailed information see [1989 robison in bugs.md](/bugs.md#1989-robiso
|
|||||||
```sh
|
```sh
|
||||||
./robison
|
./robison
|
||||||
11x10
|
11x10
|
||||||
|
# enter other expressions
|
||||||
|
|
||||||
echo 1x10x111 | ./robison
|
./try.sh
|
||||||
|
|
||||||
echo 1+1+10 | ./robison
|
|
||||||
|
|
||||||
echo 100 - 1 | ./robison
|
|
||||||
|
|
||||||
echo -100 x 100 + 1 | ./robison
|
|
||||||
|
|
||||||
echo 100 / 100 | ./robison # <-- what happens here ?
|
echo 100 / 100 | ./robison # <-- what happens here ?
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: This program will very likely crash or break into tiny bits
|
NOTE: This program will very likely crash or break into tiny bits :-) if you
|
||||||
:-) if you feed it numbers with non-binary digits.
|
feed it numbers with non-binary digits. This, as you might notice if you try one
|
||||||
|
of the above commands, can happen with other input as well. If you wish to
|
||||||
This is supposed to happen. As is written in the
|
understand why this happens check the source code.
|
||||||
[The Jargon File](http://catb.org/jargon/html/F/feature.html):
|
|
||||||
|
|
||||||
```
|
|
||||||
That's not a bug, that's a feature.
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# try.sh - demonstrate IOCCC winner 1989/robison
|
||||||
|
#
|
||||||
|
|
||||||
|
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||||
|
# this way allows us to have the user specify a different compiler in an easy
|
||||||
|
# way.
|
||||||
|
if [[ -z "$CC" ]]; then
|
||||||
|
CC="cc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make CC="$CC" all >/dev/null || exit 1
|
||||||
|
|
||||||
|
# clear screen after compilation so that only the entry is shown
|
||||||
|
clear
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo 1x10x111 | ./robison: "
|
||||||
|
echo 1>&2
|
||||||
|
echo 1x10x111 | ./robison
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo 1+1+10 | ./robison: "
|
||||||
|
echo 1>&2
|
||||||
|
echo 1+1+10 | ./robison
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo 100 - 1 | ./robison: "
|
||||||
|
echo 1>&2
|
||||||
|
echo 100 - 1 | ./robison
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo -100 x 100 + 1 | ./robison: "
|
||||||
|
echo 1>&2
|
||||||
|
echo -100 x 100 + 1 | ./robison
|
||||||
|
echo 1>&2
|
||||||
|
|
||||||
|
read -r -n 1 -p "Press any key to run: echo 101x111-100 | ./robison: "
|
||||||
|
echo 1>&2
|
||||||
|
echo 101x111-100 | ./robison
|
||||||
|
echo 1>&2
|
||||||
@@ -543,6 +543,9 @@ If you want to try and fix this (mis)feature, you are welcome to try.
|
|||||||
This program will very likely crash or break into tiny bits :-) if you feed it
|
This program will very likely crash or break into tiny bits :-) if you feed it
|
||||||
numbers with non-binary digits.
|
numbers with non-binary digits.
|
||||||
|
|
||||||
|
There are also other cases where this can happen for instance using unsupported
|
||||||
|
operators like `/`. To see what operators are supported check the source code.
|
||||||
|
|
||||||
|
|
||||||
## 1989 westley
|
## 1989 westley
|
||||||
|
|
||||||
|
|||||||
@@ -849,6 +849,8 @@ cd 1989/robison ; make diff_orig_prog
|
|||||||
|
|
||||||
(It adds the C token pasting operator `##` instead of `/**/`.)
|
(It adds the C token pasting operator `##` instead of `/**/`.)
|
||||||
|
|
||||||
|
Cody also added the [try.sh](/1989/robison/try.sh) script.
|
||||||
|
|
||||||
|
|
||||||
## <a name="1989_tromp"></a>[1989/tromp](/1989/tromp/tromp.c) ([README.md](/1989/tromp/README.md]))
|
## <a name="1989_tromp"></a>[1989/tromp](/1989/tromp/tromp.c) ([README.md](/1989/tromp/README.md]))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user