Subroutine Calling Protocol

From GM-RKB
(Redirected from calling convention)
Jump to navigation Jump to search

A Subroutine Calling Protocol is a programming language implementation-level scheme that defines how subroutines or functions receive parameters from their caller and return a result.



References

2024

  • (Wikipedia, 2024) ⇒ https://en.wikipedia.org/wiki/calling_convention Retrieved:2024-1-25.
    • In computer science, a calling convention is an implementation-level (low-level) scheme for how subroutines or functions receive parameters from their caller and how they return a result. When some code calls a function, design choices have been taken for where and how parameters are passed to that function, and where and how results are returned from that function, with these transfers typically done via certain registers or within a stack frame on the call stack. There are design choices for how the tasks of preparing for a function call and restoring the environment after the function has completed are divided between the caller and the callee. Some calling convention specifies the way every function should get called. The correct calling convention should be used for every function call, to allow the correct and reliable execution of the whole program using these functions.