10 ms·
> C hardcodes assumptions about the stack that prevent certain low level optimizations. Would you please expand on this? I can't think of any assumptions C ma
by froydnj 16y ago
> C hardcodes assumptions about the stack that prevent certain low level optimizations.
Would you please expand on this? I can't think of any assumptions C makes about the stack that C++ wouldn't make; neither can I think of low-level optimizations that said assumptions prohibit. I'm curious about what you have in mind.
- shasta 16y agoI just meant that the role of the stack is hardcoded. In most assemblys you can write to the stack pointer and presto, you're working with a new stack. This is a capability of assembly that C doesn't expose.
- stcredzero 16y agolongjmp()?
- shasta 16y agoNo, that only lets you jump out - not e.g. jump between several suspended computations.
- jcl 16y agoIt raises a valid issue though: The article's author is operating under the assumption that any replacement language must be totally interoperable with C -- both calling and being called. If you have some crazy stack-reassignment logic in a new language, it will break a native C function's ability to longjmp out of a calling function written in the new language.
- froydnj 16y agoSure you can. This is how user-level threading packages work if you don't have kernel support.
- shasta 16y agoInteresting, it seems many C implementations do support this. It's not standard C, though.