The code can recursively call main() as long by changing the name of the
argv and by a cast in the call.
Updated Makefile to disable a new warning.
Improved index.html file.
In particular although main() has to have two args don't do (void)argc
as that was not in the code.
To make it more consistent with other added functions (that I had to do
in other entries for instance and for the same reason) I made the
function poke() (r short of poker) pain() instead.
The thanks file was modified for this entry too, improving it a bit
(hopefully making certain points clearer too).
There were two things that had to change with my previous fix (getting
it to compile), one in code and one in the Makefile.
Instead of doing ',1' after the calls to longjmp() do ',0'. The way it
originally was is in binary expressions but since the function returns
void I made the result be 0 rather than 1 and along with the other
change it works (though maybe it would work with 1 anyway but it seems
not to be necessary and I don't feel like testing it now).
The Makefile change is that it won't work right with the optimiser
enabled so that was disabled.
I removed this entry from bugs.md (which was listed twice by accident -
and some other things were too) and updated it in the
thanks-for-fixes.md file as well.
main() had one arg, a char *, and this is against clang requirements.
There was no inclusion of setjmp.h and so the longjmp() function
implicitly returned int and was allowed to take the wrong number of
args. It should return void however and this caused a problem with
binary expressions. The comma operator has been used for this but it
might be a problem in that by having ,1 after each it will make
expressions that could turn out to be false to be incorrect.
The longjmp() was being called with one arg which was an element of an
int[4][1000]. This is obviously incorrect but at some point it worked.
Without the prototype this is not a problem but both before (gcc) and
after the compiler fix (with gcc and clang) it did not work with linux
(in this case fedora) or macOS. The code as it now stands has the same
problem as it did before the compilation fix: it lets you input a bet
but then it does not accept any input after that; it prints nothing more
but it should print a new hand. This issue has been put in bugs.md.
My guess (in my tired head) is it has to do with the abuse of the
longjmp() and/or the comma operator making the expressions always 1 (at
least that side of the expression, thus if it gets to the longjmp() part
it will always be 1). Perhaps it should be ,0? I don't know but I might
try that next (I would guess it should be whatever an implicit int would
return without a return statement but that's just a guess). But given
that it stops working at the same spot perhaps it's not the comma
operator. Maybe the function needs to be broken up into several but I
don't know and that might or might not be worth the effort.
Finally it returned main() itself but now it returns poke() which has
the body of what main used to be.
See bugs.md for more details.
We we move 1988-2004 entries from all of a year's winning entries
in a single directory to each winner being in their own sub-directory
under the given year directory.