- 论坛徽章:
- 0
|
int i = 0;
int res = 0;
res = ++i+ ++i+ ++i+ ++i+ ++i+ ++i+ ++i;
反编译,看到
080483b4 <main>:
80483b4: 55 push %ebp
80483b5: 89 e5 mov %esp,%ebp
80483b7: 83 ec 10 sub $0x10,%esp
80483ba: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80483c1: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
80483c8: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80483cc: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80483d0: 8b 45 fc mov -0x4(%ebp),%eax
80483d3: 01 c0 add %eax,%eax
80483d5: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80483d9: 03 45 fc add -0x4(%ebp),%eax
80483dc: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80483e0: 03 45 fc add -0x4(%ebp),%eax
80483e3: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80483e7: 03 45 fc add -0x4(%ebp),%eax
80483ea: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80483ee: 03 45 fc add -0x4(%ebp),%eax
80483f1: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80483f5: 03 45 fc add -0x4(%ebp),%eax
80483f8: 89 45 f8 mov %eax,-0x8(%ebp)
80483fb: c9 leave
80483fc: c3 ret
80483fd: 90 nop
80483fe: 90 nop
80483ff: 90 nop
前两次++操作,跟后面的不一样,
像这样的行为,在不同的编译器下的行为是不是一致的 ? |
|