2004/burley compiles with clang + try fixing it
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.
This commit is contained in:
1 parent
41d2d7fb6a
commit
c8c1dd403d
4 files changed
+81
-38
No files matched your search
@@ -64,7 +64,7 @@ X11_INCDIR= /opt/X11/include
|
||||
#
|
||||
#CSILENCE=
|
||||
CSILENCE= -Wno-bitwise-op-parentheses -Wno-char-subscripts -Wno-error \
|
||||
-Wno-implicit-function-declaration -Wno-int-to-pointer-cast
|
||||
-Wno-implicit-function-declaration -Wno-int-to-pointer-cast -Wno-unused-value
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
@@ -98,7 +98,7 @@ CDEFINE=
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
CINCLUDE= -include stdio.h -include setjmp.h -include string.h -include time.h -include stdlib.h
|
||||
#CINCLUDE= -include stdlib.h
|
||||
#CINCLUDE= -include stdio.h
|
||||
#CINCLUDE= -include stdlib.h -include stdio.h
|
||||
|
||||
Reference in new issue
Block a user