amusing to think that the goal of them is probably to make it easier avoid buffer overruns, but then they can just be extended themselves to cause similar problems anyway.
C99 doesn't need function bodies, or 'VLAs are Turing complete'
51–60 of 257 posts
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#52This is only tangential to the article: C isn't Turing complete without `fseek` (as far as I can tell). Turing completes requires you to be able to read/write from an infinite tape (essentially infinite memory). This isn't possible in C, because `sizeof` is a constant expression, thus limiting the size of any type, and importantly also pointer type, to a finite number, thus making the addressable memory finite. From…
Your argument sort of imploded on itself…your claim that only a file can be considered tape is insane because memory is just as usable as tape and you can keep extending memory available to you using sbrk() . If you’re going to claim the memory is finite, well so are files. (Also lseek is not part of any C spec) And yes neither is infinite, so every computer is just a DFA, and lseek changes nothing. But given the amo…
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#53This is only tangential to the article: C isn't Turing complete without `fseek` (as far as I can tell). Turing completes requires you to be able to read/write from an infinite tape (essentially infinite memory). This isn't possible in C, because `sizeof` is a constant expression, thus limiting the size of any type, and importantly also pointer type, to a finite number, thus making the addressable memory finite. From…
You are pedantically correct and wrong. Even with fseek there are only so many atoms in the universe and you'd eventually run into limited memory. Rather than go so esoteric as to say that only programs structured with fseek are Turing complete, we generally just make the jump from languages able to use arbitrarily sized RAM to assuming infinite RAM and say youre turing complete enough for most purposes.
I should've explained that I'm not talking about a physical implementation, but about the theoretical bounds of the C abstract machine.
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#54Earlier quoted context omitted.
Your argument sort of imploded on itself…your claim that only a file can be considered tape is insane because memory is just as usable as tape and you can keep extending memory available to you using sbrk() . If you’re going to claim the memory is finite, well so are files. (Also lseek is not part of any C spec) And yes neither is infinite, so every computer is just a DFA, and lseek changes nothing. But given the amo…
My argument is that `fseek` (not `lseek`) is the only way for standard C to access a infinite tape, because it allows relative seeking in a file. `fseek(file, 1, SEEK_CUR)` to advance and `fseek(file, -1, SEEK_CUR)` to go back.
Pointer—-
These do the same to pointers…
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#55This is only tangential to the article: C isn't Turing complete without `fseek` (as far as I can tell). Turing completes requires you to be able to read/write from an infinite tape (essentially infinite memory). This isn't possible in C, because `sizeof` is a constant expression, thus limiting the size of any type, and importantly also pointer type, to a finite number, thus making the addressable memory finite. From…
You could just make a doubly-linked list that dynamically grows new nodes (using malloc()) at either end on demand in order to implement an infinite tape. (Of course on a real machine the malloc() will fail at some point.)
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#56Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#57Earlier quoted context omitted.
My argument is that `fseek` (not `lseek`) is the only way for standard C to access a infinite tape, because it allows relative seeking in a file. `fseek(file, 1, SEEK_CUR)` to advance and `fseek(file, -1, SEEK_CUR)` to go back.
Pointer++ Pointer—- These do the same to pointers…
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#58Earlier quoted context omitted.
> People who seek to write one language and execute another are fundamentally insane. That would be people who use compilers.
You're technically right, which is the best kind of not invited to happy hour.
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#59This is only tangential to the article: C isn't Turing complete without `fseek` (as far as I can tell). Turing completes requires you to be able to read/write from an infinite tape (essentially infinite memory). This isn't possible in C, because `sizeof` is a constant expression, thus limiting the size of any type, and importantly also pointer type, to a finite number, thus making the addressable memory finite. From…
Re: C99 doesn't need function bodies, or 'VLAs are Turing complete'
#60Earlier quoted context omitted.
Pointer++ Pointer—- These do the same to pointers…
No, pointers always have a finite size, because sizeof is a constant expression. A theoretically fseek isn't bound by this, the compiler could implement it with an infinite tape.