On 8/1/23 12:51 PM, Paul Koning wrote:
How is it possible to write valid C that is correct only if some optimization 
is done?

Perhaps "incorrect" was the wrong word. If sibling-call optimization is not done, then perhaps the program will blow out the stack, which would not happen if the optimization is done.

Also, transforming sibling calls is an optimization for C, but for Scheme it's a part of the language. Translating Scheme to C has to take that into account: if there is no sibling-call optimization, then the Scheme code is translated to C code that uses a so-called trampoline; if there is sibling-call optimization that the Scheme compiler can rely on, then taking advantage of the optimization leads to faster Scheme code.

Brad

Reply via email to