4 ms·
> strcpy in C is Turing complete How so? You've made this claim twice (https://news.ycombinator.com/item?id=27910640 https://news.ycombinator.com/item?id=27910
by fargle 5y ago
> strcpy in C is Turing complete
How so? You've made this claim twice (https://news.ycombinator.com/item?id=27910640 https://news.ycombinator.com/item?id=27910640), but I can find nothing else to back this up. We know about C++ templates "accidentally" being discovered to be Turing complete, but I've never heard of strcpy() being so...
while((*p++=*q++));
... I'm not seeing it.
Honest question, can you shed light on how this can be?
- PaulHoule 5y agoStrcpy is a good setup for a buffer overflow despite having to run a gauntlet of countermeasures to really pull it off in 2022.
- fargle 5y agoWell, OK, but that isn't fair to say "C" or strcpy(). That's the implementation - so is it surprising that the common underlying implementation of "C" can be coerced into indeterminate or even Turing complete behavior? It's fair to say that C allows unsafe calls. It's useless to point out that undefined-behavior and unsafe calls could result in Turing completeness. Strcpy() is not Turing complete - it doesn't automatically detect and protect against unsafe usages. That are evil.