应用程序中的每个线程都需要内存来保存它的栈(用于在调用函数时保存本地变量和维持状态的内存区)。
Every thread in an application requires memory to hold its stack (the area of memory used to hold local variables and maintain state when calling functions).
这意味着我们必须手工重新编写栈来仿造一个返回地址,以使得尾部调用的函数能直接返回到调用它的函数。
This means that we have to manually rewrite the stack to fake a return address so that the tail-called function will return directly to our parent.
当函数返回到进行调用的函数时,后者一定不能依赖于仍在栈中的参数列表。
The calling function must not depend on the parameter list still being on the stack when your function returns to it.
好像一旦控制权传递给了尾部调用的函数,栈中就再也没有有用的内容了。
It seems that once control is passed to the tail-called function, nothing in the stack is useful anymore.
栈顶的地址就代表最后一次被调用的函数(也就是当前的活动函数)。
The address at the top of the stack represents the function that was last called (that is, the active function).
在程序的正常操作过程中,当调用一个函数时,被调用函数的所有参数以及返回位置的指针都放在栈中。
During normal operation of a program, when a function is called, any arguments for the called function along with a pointer to the return location are placed onto the stack.
当句柄范围的析构函数被调用时,所有在那个范围中创建的句柄都将被从栈中移除。
When the handle scope's destructor is called all handles created within that scope are removed from the stack.
例如,前面描述的 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.
如果不使用引用,就需要将整个数组或hash 表复制到该函数的调用栈中,然后在函数中再次对其进行复制。
Without a reference, you copy the entire array or hash onto the function call stack, and then copy it again in the function.
最后的调用(尾(tail))只是调用函数,没有任何过程调用或栈维护开销。
The last call (the tail) simply invokes the function without any procedure call or stack maintenance overhead.
图6.1表明了这一系列函数调用过程中的栈图。
Figure 6.1 shows what the stack diagram looks like for this sequence of function calls.
最后,因为异常被传回一直到主调函数的栈,你可以在(被调用函数)的任何地方捕获错误。
Finally, because the exception is passed back up the stack of calling functions, you can handle errors at any place you choose.
在本书的第三章第九节,我们用栈图来表征函数调用过程中程序的状态。
In Section 3.9, we used a stack diagram to represent the state of a program during a function call.
传递给该函数的参数已某个确定的顺序压入栈,他的返回值也以确定的方式传回调用者。
The arguments to the function are pushed onto the stack in a certain order. The return value is passed back to the invoking function in a certain way.
每次函数调用,一些状况信息须要推动栈中,所以一旦该函数完成,履行将从它分开的处所持续。
Each time a function is called, some state information needs to be pushed on a stack, so that once the function has completed, execution can continue where it left off.
每次函数调用,一些状态信息需要推进栈中,所以一旦该函数完成,执行将从它离开的地方继续。
Each time a function is called, some state information needs to be pushed on a stack, so that once the function has completed, execution can continue from where it left off.
当协议栈需要获取数值是,它通过调用回调函数来实现,该回调函数以寄存器地址和数量作为参数。
Whenever the protocol stack requires a value it calls one of the callback function with the register address and the number of registers to read as an argument.
栈帧:每次程序执行一次函数调用的时候,程序何处调用的相关信息被保存在一块称为栈帧的数据中,栈帧也常简称为帧。
Stack frame: Each time a program performs a function call, the information about where in your program the call was made from is saved in a block of data called a stack frame, or frame for short.
这是调用方与被调用方约定好如何互相传递参数和返回值,以及函数自己如何使用栈。
These are the methods that a calling function and a called function agree on how parameters and return values should be passed between them, and how the stack is used by the function itself.
如果该设备需要回应网络请求, 则其必须调用eMBEnable()函数来激活协议栈。
If the device is ready to answer network requests it must then call eMBEnable() to activate the protocol stack.
尽管如此,我们只有一个主线程加一个调用栈,所以为避免在读取那个文件时又去处理另一个请求,回调函数需要等待调用栈变空。
However, we only have one main thread and one call-stack, so in case there is another request being served when the said file is read, its callback will need to wait for the stack to become empty.
尽管如此,我们只有一个主线程加一个调用栈,所以为避免在读取那个文件时又去处理另一个请求,回调函数需要等待调用栈变空。
However, we only have one main thread and one call-stack, so in case there is another request being served when the said file is read, its callback will need to wait for the stack to become empty.
应用推荐