Re: Quines



On Fri, 11 Jan 2008 17:52:32 -0500, Kenneth Brody wrote:
[Note: The example from smr is an empty file, and won the "Worst Abuse
of the Rules" award at the 1994 Obfuscated C Code contest.]

Meaning that you cannot run the program, meaning that no output will be
generated, meaning that you have just generated the source code.
(Perhaps the original rules allowed such a loophole?)

No, that is not the loophole.

Quoting from <http://www.de.ioccc.org/1994/smr.hint>:

While strictly speaking, smr.c is not a valid C program, it is
not an invalid C program either! Some C compilers will compile
an empty file into a program that does nothing. But even if your
compiler can't, the build instructions supplied with this entry
will produce an executable file. On most systems, the stdout
from the executable will exactly match original source.

Of course, this is wrong as far as relevant for this group. While
compilers are certainly allowed to translate empty source files into
executables that do nothing, or even executables that do something, such
programs violate a constraint and the compiler must issue a diagnostic.
If the implementation chooses not to make this diagnostic a hard error,
that's fine, but it doesn't make the code any less invalid as C.

(And the build instructions referenced don't interpret the program as C
source code.)
.



Relevant Pages

  • Re: basic question about #include declarations
    ... This results from praxis in the old days when compilers were used to ... The answer is that "development environments" have a twofold role: ... OUTSIDE just as overwhelming and without human meaning as Visual ... It was however an early programming discovery that from the inside a ...
    (comp.programming)
  • Re: Executable sizes of HLLs
    ... and Modula-2 produce larger code than most C compilers ... seems the resulting executables always come out bloated. ... libraries for other languages, maybe C++. ... shared lib code. ...
    (comp.programming)
  • Re: basic question about #include declarations
    ... > buried inside development environments, ... to whom compilers and link editors were things of meaning ... > OUTSIDE just as overwhelming and without human meaning as Visual ... > It was however an early programming discovery that from the inside a ...
    (comp.programming)
  • Re: About Visual C++ 2005 Express Edition
    ... which should show up the overhead of various compilers quite well: ... int main ... The code of printf is very bulky since needs an extended precision ...
    (comp.lang.c)
  • Re: periodic frustration
    ... meaning for the term 'race condition' and thus defined 'a ... The term "data race" is also used throughout C11... ... because after the occasion has ... and the code works with old and new compilers. ...
    (comp.unix.programmer)