Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嵌入式类型如 int、char 等可以使用寄存器从函数返回,但如果函数返回一些大对象怎么办。我建议不能将进程的堆栈用于此类问题,对吗?谁能解释对象如何传递给被调用者?
SomeObj function() { SomeObj someObj; return someObj; }
通常在大多数编译器中,堆栈用于此目的。即使对于大型物体,情况仍然如此。当被调用函数返回时,调用函数期望在堆栈上找到被调用函数的值。
解决方案之一是在调用函数之前保留堆栈区域。被调用的函数可以访问该区域以填充结果(对堆栈的访问毕竟不限于顶部)。
I've an object that is include property ID with values between 101 and 199. How to order it like 199,101,102 ... 198?
199,101,102 ... 198
In result I want to put last item to f