Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C is crap

Name: Anonymous 2015-09-08 21:42

The next time I hear some idiot say ``an array is just a pointer'' I'm going to write an OS in Haskell and remotely install it on their computer.

Name: Anonymous 2016-08-26 18:43

>>65
Function calls are a specific mechanism implemented with goto. In addition to executing GOTO to the start of the function code, it also pushes the current instruction address onto the stack, and also reserves sufficient space in the stack frame for all the function's local variables. When the function returns, the local variables are deallocated and the return address is popped off the stack and assigned to the instruction pointer, so execution can pick up where it left of.

>>66
They are, with tail-call optimization. Tail recursion provides functionality equivalent to a loop, while if unoptimized will use up unnecessary stack space. TCO transforms it into a loop, which is implemented in machine code with a jump or branch instruction, which is the same as a GOTO.

>>68
I presume that's also a GCC-specific feature?
It's a GNU extension, so not part of any C standard. TCC supports it as well, but most C compilers do not. And the standard switch statement can be considered a form of computed goto.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List