C++ not Turing Complete?
C++ not Turing Complete?
Posted Dec 11, 2022 16:21 UTC (Sun) by excors (subscriber, #95769)In reply to: C++ not Turing Complete? by gmatht
Parent article: Rust support coming to GCC
> * 6.9.2.2 Forward progress [intro.progress]
> The implementation may assume that any thread will eventually do one of the following:
> - terminate,
> - make a call to a library I/O function,
> - perform an access through a volatile glvalue, or
> - perform a synchronization operation or an atomic operation.
> [Note: This is intended to allow compiler transformations such as removal of empty loops, even when termination cannot be proven. - end note]
So I believe your "while(true){BigNumber++}" is violating that assumption and the compiler may remove the loop and execute the code that's after the loop, unless BigNumber is volatile or atomic (which is an easy way to make it legal and avoid any concerns about Turing completeness).