From b400fc22fb7c3bd6e42b586b0d6ec37cadd34080 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 18 Oct 2023 09:03:04 -0700 Subject: [PATCH] Improve slightly my fix to 1988/phillipps As main() used K&R style I changed main() to use K&R. The function that it became (to fix it), pain(), already has the same exact format of what main() once was only named painfully. Since main() also had the function on many lines, even just the return statement in the beginning, I did this in main() but given that main() only calls pain() obviously this is not perfect. This has been documented in the thanks file like for all the other improvements, to keep track of it. Format/typo check README.md. --- 1988/phillipps/README.md | 9 ++------- 1988/phillipps/phillipps.c | 11 ++++++++++- thanks-for-fixes.md | 8 +++++++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/1988/phillipps/README.md b/1988/phillipps/README.md index 5340c1e6f..8f410d3ce 100644 --- a/1988/phillipps/README.md +++ b/1988/phillipps/README.md @@ -1,12 +1,7 @@ # Least likely to compile successfully -Ian Phillipps -Cambridge Consultants Ltd -Science Park -Milton Road -Cambridge CB4 4DW -England - +Ian Phillipps
+UK ## To build: diff --git a/1988/phillipps/phillipps.c b/1988/phillipps/phillipps.c index 9b6832545..6d4baf8be 100644 --- a/1988/phillipps/phillipps.c +++ b/1988/phillipps/phillipps.c @@ -51,4 +51,13 @@ pain(0, pain(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry") ,a+1);} -main(int t,char **_,char **a){return pain(t,(int)_,(char *)a);} +main(t,_,a ) +char +** +_, +** +a; +{ + return +pain(t,(int)_, +(char *)a);} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index f8e6b45d4..e93b34a01 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -421,7 +421,13 @@ that with gcc it printed random characters. After fixing it for clang by changing `main()` to call the new function `pain()` (chosen because it's a pain that clang requires these args to be `char **` :-) ) -with the correct args it now works. +with the correct args it now works with gcc and clang. + +Later Cody improved the fix to make it look a bit more like the original, using +K&R style functions, and trying to match the format as best as possible of what +`main()` used to look like but without the full body that cannot exist as it +once did. The format of `pain()` is exactly like how `main()` was as it's the +same code. ## [1988/reddy](1988/reddy/reddy.c) ([README.md](1988/reddy/README.md))