Merge pull request #182 from xexyl/stats

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2025-08-05 12:03:59 -07:00
commit dee601f32f
4 files changed
+71 -60

No files matched your search

+27 -21
View File
@@ -56,10 +56,11 @@ inside this C code. :-)
> Fun fact: after winning this, the author played the game in gdb from start to > 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 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** (!) 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 line jumps. Skipping prog.c function calls and it's still **776** jumps! The
lines that have only braces, as well as 14 blank lines, has only 85 lines. A prog.c, if you remove `#include`s, blank lines, lines with just a brace and
very tiny fraction of the time a line might be repeated in a row ONCE but that lines that have only variables, has only 59 lines of code. A very tiny fraction
does not really matter. 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 **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 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 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 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 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 of **985** (!) changes, counting function calls, and **776** (!) excluding
functions is a jump); calls to the macros are not counted. 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 This program, if you remove blank lines and lines with just a brace,
COUNTING the `#include`s, `#define`s, other functions and 14 blank lines that `#include`s and only variables, has a mere 59 (!) lines.
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 A program that has only 59 lines of code that jumps 985 (counting functions) or
diabolical to follow this code (and the theme of the game fits as well); the 776 (just in main()) times is astonishing. Of course that's not the
[obfuscation.html](obfuscation.html) shows even more on this - and the other only technique but the title of the award and the judges' remarks are rather
things I did as well. 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 > 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 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. he was wrong.
It is not about not trying. But even IF he WAS right, he 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. 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 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. 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 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 embrace it to do this. I went full out and I could have fit more `goto`s in: not
(or felt like fewer events would be worth it) I would have done even more only is the iocccsize not 2503 but I could have removed some events if I really
`goto`s for this very reason. wanted more `goto`s.
Even flex/bison code, which as far as I am aware uses FAR fewer `goto`s, is 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 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 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 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 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): **SECURITY HOLE** (CVE-2014-1266):
<https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html>. <https://www.blackduck.com/blog/understanding-apple-goto-fail-vulnerability-2.html>.
That's all it takes: **JUST ONE `goto` led to a CVE**! That's all it takes: **JUST ONE `goto` led to a CVE**!
+26 -21
View File
@@ -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 <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 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> (!) 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 line jumps. Skipping prog.c function calls and it’s still <strong>776</strong> jumps! The
lines that have only braces, as well as 14 blank lines, has only 85 lines. A prog.c, if you remove <code>#include</code>s, blank lines, lines with just a brace and
very tiny fraction of the time a line might be repeated in a row ONCE but that lines that have only variables, has only 59 lines of code. A very tiny fraction
does not really matter.</p> of the time a line might be repeated in a row ONCE but that does not really
matter.</p>
</blockquote> </blockquote>
<p><strong>NOTE</strong>: I actually submitted two versions. This one is not encrypted. The <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 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> 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 <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 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 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 of <strong>985</strong> (!) changes, counting function calls, and <strong>776</strong> (!) excluding
functions is a jump); calls to the macros are not counted.</p> function calls. Macros are not counted of course.</p>
<p>This is in a program that is <strong>JUST 85 (!) lines</strong>! A program that has only 85 lines <p>This program, if you remove blank lines and lines with just a brace,
COUNTING the <code>#include</code>s, <code>#define</code>s, other functions and 14 blank lines that <code>#include</code>s and only variables, has a mere 59 (!) lines.</p>
jumps 985 times is astonishing. Of course that’s not the only technique but the <p>A program that has only 59 lines of code that jumps 985 (counting functions) or
title of the award and the judges’ remarks are rather fitting as it is 776 (just in main()) times is astonishing. Of course that’s not the
diabolical to follow this code (and the theme of the game fits as well); the only technique but the title of the award and the judges’ remarks are rather
<a href="obfuscation.html">obfuscation.html</a> shows even more on this - and the other fitting as it is diabolical to follow this code (and the theme of the game fits
things I did as well.</p> 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> <blockquote>
<p>I have yet to see a single study that supported the supposition that GOTOs are <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 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 said was missing. And it was about time. Not that it didn’t happen before. But
he was wrong.</p> he was wrong.</p>
<p>It is not about not trying. But even IF he WAS right, he <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> 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 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. 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 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 embrace it to do this. I went full out and I could have fit more <code>goto</code>s in: not
(or felt like fewer events would be worth it) I would have done even more only is the iocccsize not 2503 but I could have removed some events if I really
<code>goto</code>s for this very reason.</p> 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 <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 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> 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 <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 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 that? Very carefully - and I nearly lost my mind doing it. I will not make any
judgement on anyone else who uses them.</p> judgement on anyone else who uses them, although I will talk about the notion
<p>Anyway, I am even reminded of Apple’s <strong>SINGLE</strong> misplaced <code>goto</code> that caused a 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): <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>. <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> That’s all it takes: <strong>JUST ONE <code>goto</code> led to a CVE</strong>!</p>
+9 -9
View File
@@ -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 mention in my <a href="#devil">remarks above</a>, EVEN ONE IS TOO MANY
in real code.</p> in real code.</p>
<p>I dare you to run the program in a debugger from start to finish to see how many <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 line jumps there truly are. After I won I did it once: removing the <code>#include</code>s,
lines (14 blank, some with just a brace, <code>#include</code>s, <code>#define</code>s included) there blank lines, lines with only variables and lines with just braces (i.e. only
were a total of 985 line changes (a tiny tiny fraction had the same line number lines of code) the program has just 59 lines and in a single run there were a
repeated once). I rarely went to the fort and I only hunted once (I might not total of <strong>985</strong> (!) line changes, counting function calls. In <code>main()</code> itself
have hunted at all). This is obscene.</p> 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 <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 I note in those concluding remarks, a <a href="https://www.apple.com">famous company</a>
hole from ONE <code>goto</code>. Yet I have 116/134 and it actually works? That is surely actually introduced a security hole from ONE <code>goto</code>. Yet I have 116/134 and it
obscene. And beautiful.</p> 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, <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> 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 (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 BASIC game by <strong>7</strong> more <code>goto</code>s at 116 before the cpp and <strong>25 MORE</strong> after the
+9 -9
View File
@@ -68,18 +68,18 @@ mention in my [remarks above](#devil), EVEN ONE IS TOO MANY
in real code. in real code.
I dare you to run the program in a debugger from start to finish to see how many 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 line jumps there truly are. After I won I did it once: removing the `#include`s,
lines (14 blank, some with just a brace, `#include`s, `#define`s included) there blank lines, lines with only variables and lines with just braces (i.e. only
were a total of 985 line changes (a tiny tiny fraction had the same line number lines of code) the program has just 59 lines and in a single run there were a
repeated once). I rarely went to the fort and I only hunted once (I might not total of **985** (!) line changes, counting function calls. In `main()` itself
have hunted at all). This is obscene. the line changed a total of **776** (!) times!
The best (or worst, depending on how you look at it :-) ) part is this works. As 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 I note in those concluding remarks, a [famous company](https://www.apple.com)
hole from ONE `goto`. Yet I have 116/134 and it actually works? That is surely actually introduced a security hole from ONE `goto`. Yet I have 116/134 and it
obscene. And beautiful. 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` 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 (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 BASIC game by **7** more `goto`s at 116 before the cpp and **25 MORE** after the