From 20849dd0d5533c8b864630e56f93d689e8278705 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 20 Mar 2023 09:23:09 -0700 Subject: [PATCH] Fix 2000/natori With clang it did not compile at all; with gcc it segfaulted. Now it works properly. It's a crescent moon today and that's exactly what is being shown. This required another function but since it wasn't a one-liner this doesn't cause any problems with the award either. --- 2000/natori/README.md | 6 ++++++ 2000/natori/natori.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/2000/natori/README.md b/2000/natori/README.md index eee43204e..9310e957b 100644 --- a/2000/natori/README.md +++ b/2000/natori/README.md @@ -12,6 +12,12 @@ Japan make ``` +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this so that it +works with modern compilers. Depending on the compiler it would either segfault +when run or not compile at all (gcc and clang respectively). Thank you Cody for +your assistance! + + ### To run: ```sh diff --git a/2000/natori/natori.c b/2000/natori/natori.c index bf22285d2..8f0c7ac16 100644 --- a/2000/natori/natori.c +++ b/2000/natori/natori.c @@ -1 +1,4 @@ -double l;main(int _,char**o,char**O){return putchar((_--+22&&_+44&&main(_,-43,_),_&&(int)o)?(main(-43,++(int)o,(int)O),((l=((int)o+21)/sqrt(3-(int)O*22-(int)O*(int)O),l*l<4&&(fabs(((time(0)-607728)%2551443)/405859.-4.7+acos(l/2))<1.57))[" #"])):10);} +double l; +int moon(int _, int o, int O){ +return putchar((_--+22&&_+44&&main(_,-43,_),_&&(int)o)?(main(-43,(int)++o,(int)O),((l=((int)o+21)/sqrt(3-(int)O*22-(int)O*(int)O),l*l<4&&(fabs(((time(0)-607728)%2551443)/405859.-4.7+acos(l/2))<1.57))[" #"])):10);} +main(int _,char**o,char**O){return moon(_, (int)o, (int)O); }