Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:10:45+00:00 2026-05-28T05:10:45+00:00

I read Ken Thompson’s classic paper Reflections on Trusting Trust in which he prompts

  • 0

I read Ken Thompson’s classic paper Reflections on Trusting Trust in which he prompts users to write a Quine as an introduction to his argument (highly recommended read).

A quine is a computer program which takes no input and produces a copy of its own source code as its only output.

The naive approach is simply to want to say:

print "[insert this program's source here]"

But one quickly sees that this is impossible. I ended up writing one myself using Python but still have trouble explaining “the trick”. I’m looking for an excellent explanation of why Quines are possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:10:46+00:00Added an answer on May 28, 2026 at 5:10 am

    The normal trick is to use printf such that the format-string represents the structure of the program, with a place-holder for the string itself to get the recursion you need:

    The standard C example from http://www.nyx.net/~gthompso/quine.htm illustrates this quite well:

    char*f="char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c";main(){printf(f,34,f,34,10);}
    

    edit: After writing this, I did a bit of searching: http://www.madore.org/~david/computers/quine.html gives a very good, more theoretical, description of what exactly quines are and why they work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

read, write, error = select.select(sockets, sockets, sockets, 60.0) What is recommended if something ends
read(2) and write(2) works both on socket descriptor as well as on file descriptor.
READ FIRST before answering! I have a RESTful service which wraps around the Entity
I read file from user using FileReference. I have a variable which I want
Read the old content into $content , then write $string . $content back into
READ FURTHER BELOW at CLI, FOR THE CLI QUESTION, WHICH JUST ADDED TO THE
Read Latency: 0.10471324863883848 ms. Write Latency: 0.10803364485981308 ms. What is the meaning of those
Read first please: This solution is intended for a limited amount of elder users
Read about Server push here . I want to push data to client from
Read on before you say this is a duplicate, it's not. (as far as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.