|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2012-4-7 11:58:20
|
显示全部楼层
C51 COMPILER V9.00 MAIN 04/07/2012 11:54:13 PAGE 1
C51 COMPILER V9.00, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE main.C LARGE OPTIMIZE(0,SPEED) CODE
line level source
1 #include "c8051f340.h"
2
3 #define UINT8 unsigned char
4
5 UINT8 fun2(void)
6 {
7 1
8 1 static UINT8 i;
9 1
10 1 i++;
11 1 return i;
12 1 }
13
14 void fun1(void)
15 {
16 1 static UINT8 i;
17 1
18 1 i = fun2();
19 1 }
20 //--------------------------------------------------------------------------------
21 void main(void)
22 {
23 1 for(;;)
24 1 {
25 2 fun1();
26 2 }
27 1 }
28
29
30
31 //---------------------- the End ----------------------------------
C51 COMPILER V9.00 MAIN 04/07/2012 11:54:13 PAGE 2
ASSEMBLY LISTING OF GENERATED OBJECT CODE
; FUNCTION fun2 (BEGIN)
; SOURCE LINE # 5
; SOURCE LINE # 6
; SOURCE LINE # 10
0000 900000 R MOV DPTR,#i
0003 E0 MOVX A,@DPTR
0004 04 INC A
0005 F0 MOVX @DPTR,A
; SOURCE LINE # 11
0006 900000 R MOV DPTR,#i
0009 E0 MOVX A,@DPTR
000A FF MOV R7,A
; SOURCE LINE # 12
000B ?C0001:
000B 22 RET
; FUNCTION fun2 (END)
; FUNCTION fun1 (BEGIN)
; SOURCE LINE # 14
; SOURCE LINE # 15
; SOURCE LINE # 18
0000 120000 R LCALL fun2
0003 900000 R MOV DPTR,#i
0006 EF MOV A,R7
0007 F0 MOVX @DPTR,A
; SOURCE LINE # 19
0008 ?C0002:
0008 22 RET
; FUNCTION fun1 (END)
; FUNCTION main (BEGIN)
; SOURCE LINE # 21
; SOURCE LINE # 22
; SOURCE LINE # 23
0000 ?C0003:
; SOURCE LINE # 24
; SOURCE LINE # 25
0000 120000 R LCALL fun1
; SOURCE LINE # 26
0003 80FB SJMP ?C0003
0005 ?C0004:
; SOURCE LINE # 27
0005 ?C0005:
0005 22 RET
; FUNCTION main (END)
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 27 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 2 ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
============================
这是一个简单的函数及其汇编,我看到fun1(),fun2()中访问的都是 #i
也就是说在内存里用的是同一个地址
结果是:大概不能重名?? |
|