From ee249da4ea4d84d2673b7a1e93a9fd0c195cd8f7 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 27 Mar 2023 07:26:25 -0700 Subject: [PATCH] Fix 1988/phillipps for modern systems The type of the second and third arg of main() were not char ** which caused clang to have a fit. In gcc this is not a problem but it printed gibberish nonetheless. Changing the type of the second and third arg to compile with clang and it printed the same (or similar?) gibberish as it did with gcc. Adding a new function (pain() as it's annoying that clang requires second, third and fourth args to main() to be 'char **'s even though in this case it didn't work anyway) and calling it from main with the appropriate args fixes the problem. --- 1988/phillipps/README.md | 9 ++++++++- 1988/phillipps/phillipps.c | 33 ++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/1988/phillipps/README.md b/1988/phillipps/README.md index 7af769532..c3acf062d 100644 --- a/1988/phillipps/README.md +++ b/1988/phillipps/README.md @@ -13,7 +13,14 @@ make all -NOTE: this program will likely segfault under macOS. + +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this for modern +systems. It did not compile with clang because it requires the second and third +args to main() to be `char **` but even before 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 paint that clang requires these args to +be `char **` :-) ) with the correct args it now works. Thank you Cody for your +assistance! ## Judges' comments diff --git a/1988/phillipps/phillipps.c b/1988/phillipps/phillipps.c index d92718a86..a271f7a26 100644 --- a/1988/phillipps/phillipps.c +++ b/1988/phillipps/phillipps.c @@ -1,50 +1,57 @@ -main(int t,char **_,char **a) +pain(t,_,a ) +char +* +a; { return! 0