在尾部调用之后除去栈结构的方法称为尾部调用优化。
The idea of removing stack frames after tail-calls is called tail-call optimization.
惟一的问题在于,现在只有非常少的编译器实现了尾部调用优化。
The only problem is that right now very few compilers implement tail-call optimizations.
例如,前面描述的 print_report_i函数在GCC 3.4 中使用-O2 进行尾部调用优化编译,因此运行时使用的栈的大小是固定的,而不是线性增长的。
For example, the print_report_i function described earlier compiled with tail-call optimization using -O2 on GCC 3.4 and therefore runs with a stack-size that is constant, not growing linearly.
这里是为那些真正热衷底层编程的人准备的一个优化尾部调用的汇编语言模板。
For those who actually like to mess with the low-level stuff, here is an assembly language template for an optimized tail-call.
这里是为那些真正热衷底层编程的人准备的一个优化尾部调用的汇编语言模板。
For those who actually like to mess with the low-level stuff, here is an assembly language template for an optimized tail-call.
应用推荐