From 25beceda9810c7c0218e235a3e1d93cfdae193f9 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 17 Oct 2023 02:44:55 -0700 Subject: [PATCH] Make my 1984/decot fix look more like original I was able to bring back some code and only had to comment out one part and make a minor change to another another. Originally the code had: extern int floor; but this is not possible in modern systems so it was changed to: extern double floor(double); The double (x1, y1) b; could be brought back, changed from: int b, (the comma is not a typo there). Now it looks rather more like the original. The thanks-for-fixes.md file was updated here, including a diff to try (to see what had to be done to fix the entry for modern systems) but I'm afraid it has a minor change in another entry, something I accidentally left out of 1984/mullender. --- 1984/decot/decot.c | 6 +++++- thanks-for-fixes.md | 21 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/1984/decot/decot.c b/1984/decot/decot.c index 1c1e5e128..1069eb7d9 100644 --- a/1984/decot/decot.c +++ b/1984/decot/decot.c @@ -3,7 +3,11 @@ #define char k['a'] #define union static struct -int b, +extern double floor(double); +double (x1, y1) b; +/*char x {sizeof( + double(%s,%D)(*)()) */ +int k['a'] = {sizeof( int(*)()) ,}; diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 865ee0e88..11a5a412c 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -115,9 +115,26 @@ A note about the fix is that the `#define`d macros that were used still exist but are not used; they are left in just to make it look more like the original entry. Nevertheless they cannot be used. +Later on Cody improved the fix to make it look rather more like the original by +bringing back an extern declaration (slightly changing it to match the symbol +that it is i.e. `extern double floor(double);` instead of `extern int floor;`) +and `double (x1, y1) b;`, commenting out only the code: + +```c +char x {sizeof( + double(%s,%D)(*)()) +``` + +and changing the type of `k` to be an `int`. + Originally Yusuke supplied a patch so that this entry would compile with gcc - but not clang - or at least some versions. +To see the difference from start to fixed: + +```sh +diff 1984/decot/decot.orig.c 1984/decot/decot.c +``` ## [1984/mullender](1984/mullender/mullender.c) ([README.md](1984/mullender/README.md])) @@ -127,8 +144,8 @@ the [FAQ](faq.md) as there are some winning entries that also let one enjoy it - with more to them of course! Cody also added the [gentab.c](1984/mullender/gentab.c) file, fixed to compile -with modern systems and so that it would create the proper array (it had -unbalanced '}'s), which the author noted in their remarks (which Cody also +and work with modern systems and so that it would create the proper array (it +had unbalanced '}'s), which the author noted in their remarks (which Cody also found). As this file uses the old header file `a.out.h` that is not available in all modern systems, Cody found a copy of it as to what it should have been at the time, in the fabulous [Unix History