Make 2004/burley fix more like original

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).
This commit is contained in:
Cody Boone Ferguson committed 2024-03-19 07:06:44 -07:00
1 parent 0d25351940
commit 632275a089
4 files changed
+27 -16

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ include ../../var.mk
#
CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts -Wno-error \
-Wno-implicit-function-declaration -Wno-int-to-pointer-cast \
-Wno-unused-value
-Wno-unused-value -Wno-unused-parameter
# Common C compiler warning flags
#
+4 -5
View File
@@ -1,8 +1,8 @@
char a[80];
int e[4],g[5],c=100,h,i,j,k,b,f,s,t;
jmp_buf p[4];
int poke(char *d){
return poke((char*)((srand(time((time_t*)&h)),
int pain(char *d){
return pain((char*)((srand(time((time_t*)&h)),
setjmp(p[2]),
(k=atoi((fgets(a,sizeof a, stdin),
a+strspn(a," -"))))
@@ -89,6 +89,5 @@ i+=i+1,
longjmp(p[0],0)),0),
longjmp(p[2],3)),0));
}
int main(int argc, char**d){
(void)argc;
return poke((char*)d); }
int main(int argc,char**d){
return pain((char*)d);}
+11 -5
View File
@@ -2095,25 +2095,31 @@ use the original version)! :-)</p>
file but a maze file. The extension <code>.maz</code> was not chosen to help with (some?)
browsers knowing what to do with it.</p>
<h2 id="burley-index.html"><a name="2004_burley"></a><a href="2004/burley/burley.c">2004/burley</a> (<a href="2004/burley/index.html%5D">index.html</a>)</h2>
<p><a href="#cody">Cody</a> fixed this to compile with clang and also fixed it to work.</p>
<p><a href="#cody">Cody</a> fixed this to compile with clang and to work with both gcc and
clang (even after fixing it to compile with clang it did not work properly).</p>
<p>For clang the problem was that <code>main()</code> had one arg, a <code>char *</code> and this is not
allowed in any version of clang. In some versions it is allowed if the arg is an
<code>int</code> but never if it’s anything else. To get it to work took numerous changes.</p>
<p>First the inclusion of <code>setjmp.h</code> was necessary. Without this <code>longjmp(3)</code>
implicitly returned <code>int</code> which was used for the purpose of binary expression but
this no longer worked.</p>
this no longer appeared to work (though it might be that if the extra function
was added earlier on it would but this is unknown and the way it was changed is
safer for the future).</p>
<p>But by including <code>setjmp.h</code> it naturally made the binary expressions invalid (as
it returns <code>void</code> which is not allowed in binary expressions) so the comma
operator with <code>0</code> (<code>,0</code>) had to be used (<code>,1</code> was tried first but this did not
work right).</p>
work right so you can see that it had to be false in those places, though it is
unknown by Cody if this is because it used to be allowed to have binary
expression with <code>void</code> or if it is for some other reason).</p>
<p><code>longjmp(3)</code> was being called with one arg which was an element
of an <code>int[4][1000]</code> which had to be changed to a <code>jmp_buf p[4]</code> (this due to
the prototype being included).</p>
<p><code>main()</code> also called itself but this was a problem so it now calls another
function <code>poke()</code> which calls itself instead (this is sometimes necessary
nowadays).</p>
nowadays and other entries had to have this same kind of change,
<a href="/2001/anonymous/index.html">2001/anonymous</a> being a good example).</p>
<p>Finally the optimiser cannot be enabled so the compiler flags were changed for
this.</p>
this, forcing <code>-O0</code>.</p>
<h2 id="gavare-index.html"><a name="2004_gavare"></a><a href="2004/gavare/gavare.c">2004/gavare</a> (<a href="2004/gavare/index.html%5D">index.html</a>)</h2>
<p><a href="#cody">Cody</a> added three different <a href="2004/gavare/index.html#alternate-code">alternate
versions</a>:</p>
+11 -5
View File
@@ -3012,7 +3012,8 @@ browsers knowing what to do with it.
## <a name="2004_burley"></a>[2004/burley](2004/burley/burley.c) ([index.html](2004/burley/index.html]))
[Cody](#cody) fixed this to compile with clang and also fixed it to work.
[Cody](#cody) fixed this to compile with clang and to work with both gcc and
clang (even after fixing it to compile with clang it did not work properly).
For clang the problem was that `main()` had one arg, a `char *` and this is not
allowed in any version of clang. In some versions it is allowed if the arg is an
@@ -3020,12 +3021,16 @@ allowed in any version of clang. In some versions it is allowed if the arg is an
First the inclusion of `setjmp.h` was necessary. Without this `longjmp(3)`
implicitly returned `int` which was used for the purpose of binary expression but
this no longer worked.
this no longer appeared to work (though it might be that if the extra function
was added earlier on it would but this is unknown and the way it was changed is
safer for the future).
But by including `setjmp.h` it naturally made the binary expressions invalid (as
it returns `void` which is not allowed in binary expressions) so the comma
operator with `0` (`,0`) had to be used (`,1` was tried first but this did not
work right).
work right so you can see that it had to be false in those places, though it is
unknown by Cody if this is because it used to be allowed to have binary
expression with `void` or if it is for some other reason).
`longjmp(3)` was being called with one arg which was an element
of an `int[4][1000]` which had to be changed to a `jmp_buf p[4]` (this due to
@@ -3033,10 +3038,11 @@ the prototype being included).
`main()` also called itself but this was a problem so it now calls another
function `poke()` which calls itself instead (this is sometimes necessary
nowadays).
nowadays and other entries had to have this same kind of change,
[2001/anonymous](/2001/anonymous/index.html) being a good example).
Finally the optimiser cannot be enabled so the compiler flags were changed for
this.
this, forcing `-O0`.
## <a name="2004_gavare"></a>[2004/gavare](2004/gavare/gavare.c) ([index.html](2004/gavare/index.html]))