Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is cool using call by refernce or call by value parameter passing?

0
Posted

Is cool using call by refernce or call by value parameter passing?

0

The manual says “formals are bound to actuals” and the method is evaluated. The cool compiler implements call by refernce by just pushing references to the objects onto the stack frame, not making copies of new objects. So, it is implementing call by reference. You should do the same. ——— Here are some hints on variable and method bindings for generating code: // VarBinding and MethodBinding methods // // From the point of view of code generation, there are five distinct // classes of names in a method: // // locals are stored in the temporary area of the stack frame // formal parameters are stored in the actuals are of the frame // self is in the SELF register // attribute is at an offset from the address given by SELF // method address is at an offset from the dispatch table // // See the discussion about frame layout under function_prologue/epilogue. // For the first four categories, there are distinct conventions for generating // code for allocation, reference, and update. F

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123