LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 634|回复: 1

请问这里的语句什么意思?

[复制链接]
发表于 2004-5-4 23:54:43 | 显示全部楼层 |阅读模式
//这里是测试用的一段c程序
#include <stdio.h>

int main()
{
  int a=1;
  int b=2;
  int c=a+b;
  printf("C is %d",c);

  return 0;
}

以上代码用gcc反汇编出来如下(未加优化选项)
.file   "testadd.c"
.section        .rodata
.LC0:
        .string "C is %d"

        .text

.globl main
        .type   main,@function
main:
        pushl   %ebp
        movl    %esp, %ebp

        subl    $24, %esp  ;
        andl    $-16, %esp ;请问这句什么意思?谢谢:-)
        movl    $0, %eax ;
        subl    %eax, %esp
        movl    $1, -4(%ebp)
        movl    $2, -8(%ebp)
        movl    -8(%ebp), %eax
        addl    -4(%ebp), %eax
        movl    %eax, -12(%ebp)

        subl    $8, %esp
        pushl   -12(%ebp)
        pushl   $.LC0
        call    printf
        addl    $16, %esp
        movl    $0, %eax
        leave
        ret
.Lfe1:
        .size   main,.Lfe1-main
        .ident  "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
发表于 2004-5-5 08:25:16 | 显示全部楼层
强迫进行字节对齐。有利于提高cpu的寻址效率。不明白就自己去看看计算机体系结构的书。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表