Make my fix to 1984/decot more like original

The #define char can be used as long as main() does not have two args
which it does not need to work. But since some versions have an
additional defect that main() can only have 0, 2 or 3 args (but see
below) it was made so that main() no longer has any args: instead the
'int i' was moved to be inside main() and set to 1 (it cannot be 0).

The version where I noticed that clang whines about the number of args
to main() will whine if it has, say, 4 args, but it will not if it has
1 and it has never whined (as an error) about passing too many args to a
function. Thus on line 29 the call to main() still passes the same
variable to main().

If clang or the ANSI C committee ruin more perfectly fun programs (both
of which seem possible) then the #define char could be renamed say to
shar or else commented out with an adjustment to 'k' (see the diff for
this commit below for where I originally had it to what it is now) or
alternatively (at the expense of making it even less like the original
in obscurity) one could remove the parameter to main() on line 29.

The way 'k' changed in this commit:

     #define char k['a']
     #define union static struct

     extern double floor(double);
     double (x1, y1) b;
    -/*char x {sizeof(
    -     double(%s,%D)(*)()) */
    -int
    -k['a'] = {sizeof(
    -    int(*)())
    +char x {sizeof(
    +     double(%s,%D)(*)())
     ,};
     struct tag{int x0,*xO;};

but now it's improved upon.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-25 04:03:40 -08:00
1 parent 4846272efd
commit d6bc864d48
3 files changed
+28 -14

No files matched your search

+2 -2
View File
@@ -42,7 +42,7 @@ CSILENCE= -Wno-array-bounds -Wno-error -Wno-implicit-function-declaration \
-Wno-keyword-macro -Wno-main-return-type -Wno-missing-field-initializers \
-Wno-unused-value -Wno-unused-variable -Wno-deprecated-non-prototype \
-Wno-empty-body -Wno-int-conversion -Wno-int-to-pointer-cast -Wno-main \
-Wno-pointer-to-int-cast -Wno-return-type -Wno-unused-label
-Wno-pointer-to-int-cast -Wno-return-type -Wno-unused-label -Wno-implicit-int
# Common C compiler warning flags
#
@@ -88,7 +88,7 @@ CC= cc
ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)"
#
CSILENCE+= -Wno-comma -Wno-format-nonliteral -Wno-missing-variable-declarations \
-Wno-pedantic -Wno-poison-system-directories -Wno-strict-prototypes \
-Wno-pedantic -Wno-poison-system-directories \
-Wno-cast-function-type -Wno-float-conversion -Wno-padded \
-Wno-unreachable-code
#
+4 -7
View File
@@ -5,17 +5,14 @@
extern double floor(double);
double (x1, y1) b;
/*char x {sizeof(
double(%s,%D)(*)()) */
int
k['a'] = {sizeof(
int(*)())
char x {sizeof(
double(%s,%D)(*)())
,};
struct tag{int x0,*xO;};
int dup, signal;
*main(int i) {
*main() {
{
int i=1,signal, dup;
for(signal=0;*k *= * __FILE__ *i;) do {
(printf(&*"'\",x); /*\n\\", (*((int(*)())&floor))(i)));
goto _0;