Sujet : Re: Writing own source disk
De : ben (at) *nospam* bsb.me.uk (Ben Bacarisse)
Groupes : comp.lang.cDate : 03. Jun 2024, 10:31:30
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87mso2mky5.fsf@bsb.me.uk>
References : 1 2 3
User-Agent : Gnus/5.13 (Gnus v5.13)
bart <
bc@freeuk.com> writes:
On 02/06/2024 23:17, Ben Bacarisse wrote:
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
Writing a prgram which writes its own source to standard output is a
standard programming problem. It's called a quine.
A quine must also not process any input.
>
No input at compile-time or runtime?
The program isn't running at compile time.
A compiler necessarily has to have the source code of the program as input,
so what are the limitations?
The compiler can do what it likes!
A C program can use #include; does that extend
to directives like #embed, or is that considered cheating?
There's nothing wrong with using either, but a C quine that uses #embed
relies on knowing the name of the file in which it is stored. It is a
"fixed point of the execution environment", but it's probably the least
interesting C quine possible -- much like
1
is a quine in languages that evaluate and print an expression.
-- Ben.