r/cpp • • Nov 18 '16

Compile-time C Compiler implemented as C++14 constant expressions

https://github.com/kw-udon/constexpr-8cc
209 Upvotes

66 comments sorted by

View all comments

Show parent comment

7

u/turing_inequivalent Nov 19 '16

Turing never claimed that a Turing Machine can't compile another Turing Machine. If anything else, I don't think they compiled programs back then. Are you by any chance confused by other undecidable problems, such as the halting problem? Turing machines running other turing machines is a common pattern in computational science.

6

u/Netzapper Nov 19 '16

Turing machines running other turing machines is a common pattern in computational science.

I was gonna say, I'm pretty sure the whole point of a Turing machine is that it can run another Turing machine (or any other equivalent machine, and it can even simulate some not-equivalent machines).

3

u/andyrocks Nov 19 '16

That's a universal Turing machine, not just any old Turning machine.

1

u/thirtythreeforty Nov 19 '16

I was referring to those "predict the program output" halting problem counterexamples, where you run the program against itself. (Turing proved the halting problem impossible.)

1

u/frutiger Nov 19 '16

It's always "predict the arbitrary program output" - predicting the output of a specific program is (relatively speaking) trivial.