Typo check 2000/primenum/README.md
Added INABIAF section as well. This has been added to bugs.md as well (some were already there but one was not - the known crash that's a feature).
This commit is contained in:
1 parent
496a0c4a00
commit
132518a399
2 files changed
+25
-11
No files matched your search
+23
-11
@@ -1,8 +1,6 @@
|
|||||||
# Best Abuse of CPP
|
# Best Abuse of CPP
|
||||||
|
|
||||||
Raymond Cheong
|
Raymond Cheong
|
||||||
[address subject to change]
|
|
||||||
MD, USA
|
|
||||||
|
|
||||||
## To build:
|
## To build:
|
||||||
|
|
||||||
@@ -18,7 +16,15 @@ echo n | ./primenum n
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: n is an integer.
|
NOTE: `n` is an integer.
|
||||||
|
|
||||||
|
### INABIAF - it's not a bug it's a feature! :-)
|
||||||
|
|
||||||
|
Although the name of the program suggests it prints prime numbers this is not
|
||||||
|
the case. This is by design. See the author's comments for more details or
|
||||||
|
better yet look at the code and if necessary try it out.
|
||||||
|
|
||||||
|
A crash in the program is known as well. This is also a feature.
|
||||||
|
|
||||||
## Try:
|
## Try:
|
||||||
|
|
||||||
@@ -49,8 +55,8 @@ numbers up to a given number (as specified on the command line).
|
|||||||
But novice programmers especially know that mistakes are often made in
|
But novice programmers especially know that mistakes are often made in
|
||||||
translating pseudocode to real code, often resulting in programs with
|
translating pseudocode to real code, often resulting in programs with
|
||||||
unexpected and confusing output. Clearly, the program contains several
|
unexpected and confusing output. Clearly, the program contains several
|
||||||
syntax "mistakes" (e.g. LessThanOrEqualTo) and blatant "errors" (e.g.
|
syntax "mistakes" (e.g. `LessThanOrEqualTo`) and blatant "errors" (e.g.
|
||||||
Zero). This program clearly requires "debugging."
|
`Zero`). This program clearly requires "debugging."
|
||||||
|
|
||||||
As a result of these "bugs", the program does not calculate primes at all.
|
As a result of these "bugs", the program does not calculate primes at all.
|
||||||
Instead, the program reads input from stdin and returns garbled text on
|
Instead, the program reads input from stdin and returns garbled text on
|
||||||
@@ -69,20 +75,26 @@ argument, otherwise the "bugs" in the program will cause it to crash!
|
|||||||
### Features
|
### Features
|
||||||
|
|
||||||
- The program attempts to mislead the reader into thinking that it
|
- The program attempts to mislead the reader into thinking that it
|
||||||
generates prime numbers. It does this by
|
generates prime numbers. It does this by:
|
||||||
* describing a correct algorithm in pseudocode,
|
* describing a correct algorithm in pseudocode;
|
||||||
* using partially correct conversion of pseudocode to real code,
|
* using partially correct conversion of pseudocode to real code;
|
||||||
* using suggestive variable names, and
|
* using suggestive variable names; and
|
||||||
* using a suggestive program name.
|
* using a suggestive program name.
|
||||||
|
|
||||||
- The program demonstrates a novel method of abusing the C preprocessor.
|
- The program demonstrates a novel method of abusing the C preprocessor.
|
||||||
- How the filter algorithm works is left as an exercise to the reader.
|
|
||||||
|
- Determining how the filter algorithm works is left as an exercise to the
|
||||||
|
reader.
|
||||||
|
|
||||||
- OK, so running it through the preprocessor strips away the prime
|
- OK, so running it through the preprocessor strips away the prime
|
||||||
number front. But ye be warned: not a11 variab1es1es are identica1 :-)
|
number front. But ye be warned: "not a11 variab1es1es are identica1" :-)
|
||||||
|
|
||||||
- Other features include
|
- Other features include
|
||||||
* useless variables
|
* useless variables
|
||||||
* useless if
|
* useless if
|
||||||
* a for loop that's used as an if statement
|
* a for loop that's used as an if statement
|
||||||
* dependence on the high bit being 0
|
* dependence on the high bit being 0
|
||||||
|
|
||||||
- Try also
|
- Try also
|
||||||
`echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32`
|
`echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32`
|
||||||
|
|
||||||
|
|||||||
@@ -1017,6 +1017,8 @@ README.md file or look at the source.
|
|||||||
It also has main() return void even though this is non-standard. Please do not
|
It also has main() return void even though this is non-standard. Please do not
|
||||||
fix this (in fact it was originally done but rolled back).
|
fix this (in fact it was originally done but rolled back).
|
||||||
|
|
||||||
|
As well there is a known crash that's also a feature.
|
||||||
|
|
||||||
|
|
||||||
# 2001
|
# 2001
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user