Merge pull request #182 from xexyl/stats
This commit is contained in:
4 files changed
+71
-60
No files matched your search
+27
-21
@@ -56,10 +56,11 @@ inside this C code. :-)
|
||||
> Fun fact: after winning this, the author played the game in gdb from start to
|
||||
finish and not counting macros but counting all function calls (not libc
|
||||
functions just the few functions in prog.c), there were a total of **985** (!)
|
||||
line jumps. The prog.c, counting `#include`s, `#define`s, functions and some
|
||||
lines that have only braces, as well as 14 blank lines, has only 85 lines. A
|
||||
very tiny fraction of the time a line might be repeated in a row ONCE but that
|
||||
does not really matter.
|
||||
line jumps. Skipping prog.c function calls and it's still **776** jumps! The
|
||||
prog.c, if you remove `#include`s, blank lines, lines with just a brace and
|
||||
lines that have only variables, has only 59 lines of code. A very tiny fraction
|
||||
of the time a line might be repeated in a row ONCE but that does not really
|
||||
matter.
|
||||
|
||||
**NOTE**: I actually submitted two versions. This one is not encrypted. The
|
||||
encrypted one even encrypted emojis without having to decrypt them in order to
|
||||
@@ -3256,18 +3257,21 @@ Except on the Oregon Trail.
|
||||
|
||||
I was right too: the entire game is worse, far far worse. After this won I did a
|
||||
full sequence. This is from start to finish and I include it for your amusement
|
||||
(see [gotos.txt](gotos.txt)). Or horror. There are a few times where the line
|
||||
(see [gotos.txt](gotos.txt) for the line changes including calls to prog.c
|
||||
functions). Or horror. There are a few times where the line
|
||||
is the same but that only shows how very often the line changes. It is a total
|
||||
of **985** (!) changes, counting function calls (i.e. each call to one of the few
|
||||
functions is a jump); calls to the macros are not counted.
|
||||
of **985** (!) changes, counting function calls, and **776** (!) excluding
|
||||
function calls. Macros are not counted of course.
|
||||
|
||||
This is in a program that is **JUST 85 (!) lines**! A program that has only 85 lines
|
||||
COUNTING the `#include`s, `#define`s, other functions and 14 blank lines that
|
||||
jumps 985 times is astonishing. Of course that's not the only technique but the
|
||||
title of the award and the judges' remarks are rather fitting as it is
|
||||
diabolical to follow this code (and the theme of the game fits as well); the
|
||||
[obfuscation.html](obfuscation.html) shows even more on this - and the other
|
||||
things I did as well.
|
||||
This program, if you remove blank lines and lines with just a brace,
|
||||
`#include`s and only variables, has a mere 59 (!) lines.
|
||||
|
||||
A program that has only 59 lines of code that jumps 985 (counting functions) or
|
||||
776 (just in main()) times is astonishing. Of course that's not the
|
||||
only technique but the title of the award and the judges' remarks are rather
|
||||
fitting as it is diabolical to follow this code (and the theme of the game fits
|
||||
as well); the [obfuscation.html](obfuscation.html) shows even more on this - and
|
||||
the other things I did as well.
|
||||
|
||||
> I have yet to see a single study that supported the supposition that GOTOs are
|
||||
harmful (I presume this is not because nobody has tried). Nonetheless, people
|
||||
@@ -3280,16 +3284,17 @@ said was missing. And it was about time. Not that it didn't happen before. But
|
||||
he was wrong.
|
||||
|
||||
It is not about not trying. But even IF he WAS right, he
|
||||
sure as hell is WRONG NOW. Anyone who thinks otherwise needs to try and debug
|
||||
sure as hell is wrong NOW. Anyone who thinks otherwise needs to try and debug
|
||||
my program - or maintain it. Or write it.
|
||||
|
||||
It would have been SO MUCH EASIER if I did not use 134 `goto`s. Actually, even a
|
||||
It would have been SO MUCH EASIER if I did not use 134 `goto`s (and I could have
|
||||
fit more in). Actually, even a
|
||||
tiny portion of that would make it harder. Nobody, whether they're in their
|
||||
right mind or not, would WANT to maintain this, or something even close to it.
|
||||
Feel free to pass on judgement to me. I welcome it! You have to be mad and
|
||||
embrace it to do this. I went full out and if I didn't have to do other things
|
||||
(or felt like fewer events would be worth it) I would have done even more
|
||||
`goto`s for this very reason.
|
||||
embrace it to do this. I went full out and I could have fit more `goto`s in: not
|
||||
only is the iocccsize not 2503 but I could have removed some events if I really
|
||||
wanted more `goto`s.
|
||||
|
||||
Even flex/bison code, which as far as I am aware uses FAR fewer `goto`s, is
|
||||
notorious for `goto`s and is quite hard to follow. It would be a nightmare to
|
||||
@@ -3421,9 +3426,10 @@ the degree I have taken it in this program, it demonstrates why you should avoid
|
||||
No matter how many you have, UNLESS IT'S 0, it makes it hard to maintain and
|
||||
ensure that the code is correct. So how did I actually manage doing exactly
|
||||
that? Very carefully - and I nearly lost my mind doing it. I will not make any
|
||||
judgement on anyone else who uses them.
|
||||
judgement on anyone else who uses them, although I will talk about the notion
|
||||
that they aren't harmful, mostly to show just how extreme this program went.
|
||||
|
||||
Anyway, I am even reminded of Apple's **SINGLE** misplaced `goto` that caused a
|
||||
Anyway, I am reminded of Apple's **SINGLE** misplaced `goto` that caused a
|
||||
**SECURITY HOLE** (CVE-2014-1266):
|
||||
<https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html>.
|
||||
That's all it takes: **JUST ONE `goto` led to a CVE**!
|
||||
|
||||
+26
-21
@@ -499,10 +499,11 @@ inside this C code. :-)</p>
|
||||
<p>Fun fact: after winning this, the author played the game in gdb from start to
|
||||
finish and not counting macros but counting all function calls (not libc
|
||||
functions just the few functions in prog.c), there were a total of <strong>985</strong> (!)
|
||||
line jumps. The prog.c, counting <code>#include</code>s, <code>#define</code>s, functions and some
|
||||
lines that have only braces, as well as 14 blank lines, has only 85 lines. A
|
||||
very tiny fraction of the time a line might be repeated in a row ONCE but that
|
||||
does not really matter.</p>
|
||||
line jumps. Skipping prog.c function calls and it’s still <strong>776</strong> jumps! The
|
||||
prog.c, if you remove <code>#include</code>s, blank lines, lines with just a brace and
|
||||
lines that have only variables, has only 59 lines of code. A very tiny fraction
|
||||
of the time a line might be repeated in a row ONCE but that does not really
|
||||
matter.</p>
|
||||
</blockquote>
|
||||
<p><strong>NOTE</strong>: I actually submitted two versions. This one is not encrypted. The
|
||||
encrypted one even encrypted emojis without having to decrypt them in order to
|
||||
@@ -3090,17 +3091,19 @@ I’m a dragon. I’m not a dragon. I have a secret for you: dragons don’t exi
|
||||
Except on the Oregon Trail.</p>
|
||||
<p>I was right too: the entire game is worse, far far worse. After this won I did a
|
||||
full sequence. This is from start to finish and I include it for your amusement
|
||||
(see <a href="gotos.txt">gotos.txt</a>). Or horror. There are a few times where the line
|
||||
(see <a href="gotos.txt">gotos.txt</a> for the line changes including calls to prog.c
|
||||
functions). Or horror. There are a few times where the line
|
||||
is the same but that only shows how very often the line changes. It is a total
|
||||
of <strong>985</strong> (!) changes, counting function calls (i.e. each call to one of the few
|
||||
functions is a jump); calls to the macros are not counted.</p>
|
||||
<p>This is in a program that is <strong>JUST 85 (!) lines</strong>! A program that has only 85 lines
|
||||
COUNTING the <code>#include</code>s, <code>#define</code>s, other functions and 14 blank lines that
|
||||
jumps 985 times is astonishing. Of course that’s not the only technique but the
|
||||
title of the award and the judges’ remarks are rather fitting as it is
|
||||
diabolical to follow this code (and the theme of the game fits as well); the
|
||||
<a href="obfuscation.html">obfuscation.html</a> shows even more on this - and the other
|
||||
things I did as well.</p>
|
||||
of <strong>985</strong> (!) changes, counting function calls, and <strong>776</strong> (!) excluding
|
||||
function calls. Macros are not counted of course.</p>
|
||||
<p>This program, if you remove blank lines and lines with just a brace,
|
||||
<code>#include</code>s and only variables, has a mere 59 (!) lines.</p>
|
||||
<p>A program that has only 59 lines of code that jumps 985 (counting functions) or
|
||||
776 (just in main()) times is astonishing. Of course that’s not the
|
||||
only technique but the title of the award and the judges’ remarks are rather
|
||||
fitting as it is diabolical to follow this code (and the theme of the game fits
|
||||
as well); the <a href="obfuscation.html">obfuscation.html</a> shows even more on this - and
|
||||
the other things I did as well.</p>
|
||||
<blockquote>
|
||||
<p>I have yet to see a single study that supported the supposition that GOTOs are
|
||||
harmful (I presume this is not because nobody has tried). Nonetheless, people
|
||||
@@ -3112,15 +3115,16 @@ dismiss any statement opposing it.</p>
|
||||
said was missing. And it was about time. Not that it didn’t happen before. But
|
||||
he was wrong.</p>
|
||||
<p>It is not about not trying. But even IF he WAS right, he
|
||||
sure as hell is WRONG NOW. Anyone who thinks otherwise needs to try and debug
|
||||
sure as hell is wrong NOW. Anyone who thinks otherwise needs to try and debug
|
||||
my program - or maintain it. Or write it.</p>
|
||||
<p>It would have been SO MUCH EASIER if I did not use 134 <code>goto</code>s. Actually, even a
|
||||
<p>It would have been SO MUCH EASIER if I did not use 134 <code>goto</code>s (and I could have
|
||||
fit more in). Actually, even a
|
||||
tiny portion of that would make it harder. Nobody, whether they’re in their
|
||||
right mind or not, would WANT to maintain this, or something even close to it.
|
||||
Feel free to pass on judgement to me. I welcome it! You have to be mad and
|
||||
embrace it to do this. I went full out and if I didn’t have to do other things
|
||||
(or felt like fewer events would be worth it) I would have done even more
|
||||
<code>goto</code>s for this very reason.</p>
|
||||
embrace it to do this. I went full out and I could have fit more <code>goto</code>s in: not
|
||||
only is the iocccsize not 2503 but I could have removed some events if I really
|
||||
wanted more <code>goto</code>s.</p>
|
||||
<p>Even flex/bison code, which as far as I am aware uses FAR fewer <code>goto</code>s, is
|
||||
notorious for <code>goto</code>s and is quite hard to follow. It would be a nightmare to
|
||||
try and maintain without the .l/.y source files.</p>
|
||||
@@ -3228,8 +3232,9 @@ the degree I have taken it in this program, it demonstrates why you should avoid
|
||||
<p>No matter how many you have, UNLESS IT’S 0, it makes it hard to maintain and
|
||||
ensure that the code is correct. So how did I actually manage doing exactly
|
||||
that? Very carefully - and I nearly lost my mind doing it. I will not make any
|
||||
judgement on anyone else who uses them.</p>
|
||||
<p>Anyway, I am even reminded of Apple’s <strong>SINGLE</strong> misplaced <code>goto</code> that caused a
|
||||
judgement on anyone else who uses them, although I will talk about the notion
|
||||
that they aren’t harmful, mostly to show just how extreme this program went.</p>
|
||||
<p>Anyway, I am reminded of Apple’s <strong>SINGLE</strong> misplaced <code>goto</code> that caused a
|
||||
<strong>SECURITY HOLE</strong> (CVE-2014-1266):
|
||||
<a href="https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html" class="uri">https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html</a>.
|
||||
That’s all it takes: <strong>JUST ONE <code>goto</code> led to a CVE</strong>!</p>
|
||||
|
||||
@@ -510,16 +510,16 @@ YES I think it’s HILARIOUS. But if it was not for the IOCCC… Well, as I
|
||||
mention in my <a href="#devil">remarks above</a>, EVEN ONE IS TOO MANY
|
||||
in real code.</p>
|
||||
<p>I dare you to run the program in a debugger from start to finish to see how many
|
||||
line jumps there truly are. After I won I did it once: in a program with just 85
|
||||
lines (14 blank, some with just a brace, <code>#include</code>s, <code>#define</code>s included) there
|
||||
were a total of 985 line changes (a tiny tiny fraction had the same line number
|
||||
repeated once). I rarely went to the fort and I only hunted once (I might not
|
||||
have hunted at all). This is obscene.</p>
|
||||
line jumps there truly are. After I won I did it once: removing the <code>#include</code>s,
|
||||
blank lines, lines with only variables and lines with just braces (i.e. only
|
||||
lines of code) the program has just 59 lines and in a single run there were a
|
||||
total of <strong>985</strong> (!) line changes, counting function calls. In <code>main()</code> itself
|
||||
the line changed a total of <strong>776</strong> (!) times!</p>
|
||||
<p>The best (or worst, depending on how you look at it :-) ) part is this works. As
|
||||
I note in those concluding remarks, a company actually introduced a security
|
||||
hole from ONE <code>goto</code>. Yet I have 116/134 and it actually works? That is surely
|
||||
obscene. And beautiful.</p>
|
||||
<p>Oh and BTW: it appears that <code>hines</code> is a bit confused about my submission,
|
||||
I note in those concluding remarks, a <a href="https://www.apple.com">famous company</a>
|
||||
actually introduced a security hole from ONE <code>goto</code>. Yet I have 116/134 and it
|
||||
actually works? That is surely obscene. And beautiful.</p>
|
||||
<p>Oh and BTW: it appears that <code>hines</code> is a bit confused about my entry,
|
||||
though I’m not really sure why. In any case, I not only have dethroned <code>hines</code>
|
||||
(sorry …but also not sorry!) but I have, as noted already, beaten the original
|
||||
BASIC game by <strong>7</strong> more <code>goto</code>s at 116 before the cpp and <strong>25 MORE</strong> after the
|
||||
|
||||
@@ -68,18 +68,18 @@ mention in my [remarks above](#devil), EVEN ONE IS TOO MANY
|
||||
in real code.
|
||||
|
||||
I dare you to run the program in a debugger from start to finish to see how many
|
||||
line jumps there truly are. After I won I did it once: in a program with just 85
|
||||
lines (14 blank, some with just a brace, `#include`s, `#define`s included) there
|
||||
were a total of 985 line changes (a tiny tiny fraction had the same line number
|
||||
repeated once). I rarely went to the fort and I only hunted once (I might not
|
||||
have hunted at all). This is obscene.
|
||||
line jumps there truly are. After I won I did it once: removing the `#include`s,
|
||||
blank lines, lines with only variables and lines with just braces (i.e. only
|
||||
lines of code) the program has just 59 lines and in a single run there were a
|
||||
total of **985** (!) line changes, counting function calls. In `main()` itself
|
||||
the line changed a total of **776** (!) times!
|
||||
|
||||
The best (or worst, depending on how you look at it :-) ) part is this works. As
|
||||
I note in those concluding remarks, a company actually introduced a security
|
||||
hole from ONE `goto`. Yet I have 116/134 and it actually works? That is surely
|
||||
obscene. And beautiful.
|
||||
I note in those concluding remarks, a [famous company](https://www.apple.com)
|
||||
actually introduced a security hole from ONE `goto`. Yet I have 116/134 and it
|
||||
actually works? That is surely obscene. And beautiful.
|
||||
|
||||
Oh and BTW: it appears that `hines` is a bit confused about my submission,
|
||||
Oh and BTW: it appears that `hines` is a bit confused about my entry,
|
||||
though I'm not really sure why. In any case, I not only have dethroned `hines`
|
||||
(sorry ...but also not sorry!) but I have, as noted already, beaten the original
|
||||
BASIC game by **7** more `goto`s at 116 before the cpp and **25 MORE** after the
|
||||
|
||||
Reference in new issue
Block a user