C/C++|图文深入理解函数调用的5种约定( 二 )

__cdecl代表性的栈示意图:

C/C++|图文深入理解函数调用的5种约定

文章插图
 
__cdecl代表性的函数栈帧的示例代码:
#include <stdio.h>struct ST{int a;double d;//ST(int aa,double dd):a(aa),d(dd){};};ST test(double d,int a){char ch = 'a';char chs[5] = "";ST st;st.a = a;st.d = d;return st;}int main(){ST s = test(2.3,4);printf("%d %fn",s.a,s.d);getchar();return 0;}ref:
http://mallocfree.com/basic/c/c-6-function.htm#79
-End-




推荐阅读