Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #385452
| From | Ben Bacarisse <ben@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Writing own source disk |
| Date | 2024-06-03 12:58 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87bk4ime5r.fsf@bsb.me.uk> (permalink) |
| References | <v3hmha$3banl$1@dont-email.me> <87sexvm1lr.fsf@bsb.me.uk> <v3iu4n$3i607$1@dont-email.me> <87mso2mky5.fsf@bsb.me.uk> <v3k49t$3rdhi$1@dont-email.me> |
bart <bc@freeuk.com> writes: > On 03/06/2024 10:31, Ben Bacarisse wrote: >> 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. > > I assume you can use __FILE__ with #embed? (I can do that with my version > of it). > > Then it doesn't need to know the actual name of the file. I don't know if that is guaranteed by the standard as I've not really looked at C23, but if is it, that would be a way to write a (rather boring) quine in C23. >> 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. > > Not really. What part are you objecting to? That the above (a C quine using #embed) in not a fixed point of the execution environment? That it's not an uninteresting quine? Or that it's not "much like" self-evaluating expression quines? You said "not really" in reply to a moderately complex paragraph. > I've just added this line: > > puts(strinclude(__FILE__)); I think I'm missing your point. That does input at run-time (if my guess about strinclude is correct). -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar
Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-02 12:54 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-02 23:17 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-03 00:09 +0100
Re: Writing own source disk Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-06-02 23:19 +0000
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-03 13:11 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-04 00:41 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-04 14:40 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-04 19:45 +0100
Re: Writing own source disk scott@slp53.sl.home (Scott Lurndal) - 2024-06-04 19:23 +0000
Re: Writing own source disk bart <bc@freeuk.com> - 2024-06-04 20:57 +0100
Re: Writing own source disk Mikko <mikko.levanto@iki.fi> - 2024-06-05 11:13 +0300
Re: Writing own source disk bart <bc@freeuk.com> - 2024-06-05 09:23 +0100
Re: Writing own source disk bart <bc@freeuk.com> - 2024-06-03 00:10 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-03 05:16 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-03 05:19 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-03 10:31 +0100
Re: Writing own source disk bart <bc@freeuk.com> - 2024-06-03 11:01 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-03 12:58 +0100
Re: Writing own source disk bart <bc@freeuk.com> - 2024-06-03 13:37 +0100
Re: Writing own source disk bart <bc@freeuk.com> - 2024-06-03 14:50 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-03 14:55 +0100
Re: Writing own source disk bart <bc@freeuk.com> - 2024-06-03 15:34 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-03 19:36 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-04 00:35 +0100
Re: Writing own source disk Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-06-03 17:33 -0700
Re: Writing own source disk Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-06-03 17:35 -0700
Re: Writing own source disk David Brown <david.brown@hesbynett.no> - 2024-06-04 09:30 +0200
Re: Writing own source disk Mikko <mikko.levanto@iki.fi> - 2024-06-05 11:19 +0300
Re: Writing own source disk Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-06-05 08:29 +0000
Re: Writing own source disk Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-06-05 11:10 -0700
Re: Writing own source disk scott@slp53.sl.home (Scott Lurndal) - 2024-06-05 18:23 +0000
Re: Writing own source disk Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-06-05 11:26 -0700
Re: Writing own source disk David Brown <david.brown@hesbynett.no> - 2024-06-05 21:27 +0200
Re: Writing own source disk Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-06-03 23:56 +0000
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-04 12:10 +0100
Re: Writing own source disk Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-06-02 23:18 +0000
Re: Writing own source disk Michael S <already5chosen@yahoo.com> - 2024-06-03 16:04 +0300
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-03 14:47 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-04 01:18 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-04 14:33 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-04 19:41 +0100
Re: Writing own source disk Richard Harnden <richard.nospam@gmail.invalid> - 2024-06-04 21:04 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-06 18:00 +0100
Re: Writing own source disk Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-06-06 20:24 +0100
Re: Writing own source disk Ben Bacarisse <ben@bsb.me.uk> - 2024-06-07 20:04 +0100
csiph-web