3 ms·
See "Subtleties of the ANSI/ISO C standard" <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1637.pdf https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1637.p
by jwilk 4y ago
See "Subtleties of the ANSI/ISO C standard" <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1637.pdf https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1637.pdf>, section V "C is not Turing complete". They discuss file I/O briefly too, but I don't follow their reasoning.
- camel-cdr 4y agoYes, this is basically my argument. They address that `ftell` must return a finite value, but don't mention that `ftell` can fail for specific FILEs: > If successful, the ftell function returns the current value of the file position indicator for the stream But FILEs don't necessarily have a "file position indicator": > If a file can support positioning requests (such as a disk file, as opposed to a terminal), then a file position indicator associated with the stream is positioned at the start (character number zero) of the file, unless the file is opened with append mode in which case it is implementation-defined whether the file position indicator is initially positioned at the beginning or the end of the file. They don't seem to discuss the topic further. > Therefore we will here only consider C programs without I/O. (Our argument can be adapted to show that the programs that restrict I/O to reading stdin and writing stdout are Turing incomplete as well, but we will not do so here.) So they don't address the problem of IO completely.