>第 19 章 汇编与C之间的关系>函数调用>习题

码匠 code_smtih@sohu.com
2009-09-16 15:56:13

Complier doesn't check how many parameters are passed into a called function. The number can be more, less or even zero than the the real parameter number in a function definition. 

Each function is a compilation unit. Because the combined use of ebp, esp, leave and ret, the program will not be crashed when it runs. Each function takes its arguments as designated order.

In foo()
   a is 2 
   b is a random value. That because b is not be used in foo(), its value is not be passed into the function.

In bar()
  c is 2
  d gets value from b value in foo's stack frame, so d value is not clear. 
  


吴亚杰 yajie.wu@hotmail.com
2010-12-19 22:11:42

压栈并不总是从右到左,这跟具体的调用惯例是有关的
cdelc、stdcall、fastcall、pascal


宋劲杉 songjinshan@gmail.com
2011-01-01 18:02:44

对的,在正式出版的书中补充解释了本章的calling convention是cdecl。


fsd sdf sd 1@126.com
2011-09-06 15:05:32

fdsgsdg sdfsd 


如果您有建设性意见,哪怕只是纠正一个错别字,也请不吝赐教,您留下的姓名和email将会出现在本书前言的致谢中。再次感谢您的宝贵意见!