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.
Any advice on selling a rewrite and/or challenges as one nears 1B daily queries for which Haskell would be uniquely advantageous?
The point about call/cc is that it is not a static (lexical) goto instruction but a dynamic oneThose are usually called exceptions (but not the only kind of exception).
sizeof arr
and &arr
? sizeof/alignof
, and address of). Instead we operate on it through pointers, and the compiler makes this convenient to do. But the array type is not the object, the pointer to the first element is not the object and the identifier is still not the object.ptr[5]
means to read data at an offset of 5 * (sizeof whatever data type the pointer is using) from the pointer itself.int * getarray(void) {
int a[5];
return a;
}
int * getarray(void) {
int * a = alloca(5 * sizeof (int));
return a;
}
int * getarray(void) {
int a * = malloc(5 * sizeof (int));
return a;
}
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.
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.
Tail recursion can work with the new parameter values in-place.which is a poor implementation