指针浅析(1)

int main()
{
    char *p_char = 0;
    int *p_int = 0;

    p_char++;
    p_int++;
}

    .file    "test.c"
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    pushl    %ebp
    .cfi_def_cfa_offset 8
    .cfi_offset 5, -8
    movl    %esp, %ebp
    .cfi_def_cfa_register 5
    subl    $16, %esp
    movl    $0, -8(%ebp)
    movl    $0, -4(%ebp)
    addl    $1, -8(%ebp)
    addl    $4, -4(%ebp) 
    movl    $0, %eax
    leave
    .cfi_restore 5
    .cfi_def_cfa 4, 4
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .ident    "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609"
    .section    .note.GNU-stack,"",@progbits

留意汇编中红色背景标出的地方。

猜你喜欢

转载自www.cnblogs.com/rivsidn/p/9226610.html