analysis code(value passing, pointer(address) passing)
来源:互联网 发布:mac 桌面上多了个磁盘 编辑:程序博客网 时间:2024/06/09 22:22
1. none change
1.1)
int a = 9;
int add1(int a,int b)
{
a = a + 1;
}
push ebp
mov ebp,esp
mov eax,dword ptr ss:[ebp+8]
add eax,1
mov dword prt ss:[ebp+8], eax
here only change temp stack's [ebp+8] location's value.
after invoke the function add1, the stack will be recovery, and the [ebp+8] location's value will has none meaning.
So the a still is not changed, it is 9.
1.2)
void cstart(int a,int b,int c)
{
}
call .**********(该函数的地址)
push ebp
mov ebp,esp
mov dword ptr ss:[ebp+0x8], 0x00000001
mov dword ptr ss:[ebp+0xc], 0x00000003
mov dword ptr ss:[ebp+0x10], 0x00000002
pop ebp
ret
2 pointer to value.
a has changed.
int i = 9;
int *a = &i;
int add1(int *a,int b)
{
*a = *a + 1;
}
As it change the temp stack's [ebp+8] location's value(actually value address) """"ssss pointed value.
So this pointer is not change(in stack and exit stack it's the same).
alrough the pointer is same after exit invoking function,
But it's pointed value is followed to change as the temp stack's value's pointed NEW value.
- analysis code(value passing, pointer(address) passing)
- JavaScript: Passing by Value or by Reference
- 嵌入式 warning: pointer targets in passing argument 1 of
- Passing Name Value Pair to the Biztalk Orchestration
- Passing by reference or by value? it is a question
- Parameter passing in Java - by reference or by value?
- Neat and clear explanation of Java's passing by value
- Passing Managed Structures With Arrays To Unmanaged Code Part 1
- Passing Managed Structures With Arrays To Unmanaged Code Part 2
- Passing Managed Structures With Arrays To Unmanaged Code Part 3
- error: pointer targets in passing argument 3 of 'accept' differ in signedness [-Werror=pointer-sign
- warning: pointer targets in passing argument 3 of ‘accept’ differ in signedness
- pointer targets in passing argument n of xxx differ in signedness
- warning: passing argument 2 of 'request_irq' from incompatible pointer type导致的中断申请失败和
- pointer targets in passing argument 1 of 'strlen' differ in signedness
- 关于问题warning: passing arg 2 of `bind' from incompatible pointer type理解
- warning: passing argument 2 of 'request_irq' from incompatible pointer type导致的中断申请失败和
- warning: pointer targets in passing argument 3 of ‘accept’ differ in signedness
- java 验证邮箱格式正确性
- 分治策略之合并排序问题
- c库(下)----小话c语言(18)
- java求吸血鬼数字算法 。。。
- 【几何】poj1118Lining up
- analysis code(value passing, pointer(address) passing)
- 分享一个小程序(Oralce数据库结构对比程序)
- 关于做Android+J2ee系统集成开发的一点心得
- Programmer Competency Matrix
- sicily--1510. Mispelling
- 探索printf()为何可以同时输出中英文字符之谜---unicode,UTF-8,字符(上)
- Java中正则表达式的使用
- linux 生产者 消费者 问题
- Splash Screen开场屏在Android中的实现