Created
July 9, 2014 00:35
-
-
Save RichardBarrell/9510198f1f8dcd466da9 to your computer and use it in GitHub Desktop.
Does calling a function defined like "foo()" differ from calling a function defined like "foo(void)"?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int foo(FOO_ARGS); | |
int main(int argc, char **argv) { | |
printf("%d!\n", foo()); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file "main.c" | |
.section .rodata.str1.1,"aMS",@progbits,1 | |
.LC0: | |
.string "%d!\n" | |
.section .text.startup,"ax",@progbits | |
.globl main | |
.type main, @function | |
main: | |
.LFB0: | |
.cfi_startproc | |
pushq %rax | |
.cfi_def_cfa_offset 16 | |
xorl %eax, %eax | |
call foo | |
movl $.LC0, %edi | |
movl %eax, %esi | |
xorl %eax, %eax | |
call printf | |
xorl %eax, %eax | |
popq %rdx | |
.cfi_def_cfa_offset 8 | |
ret | |
.cfi_endproc | |
.LFE0: | |
.size main, .-main | |
.ident "GCC: (GNU) 4.8.3 20140624 (Red Hat 4.8.3-1)" | |
.section .note.GNU-stack,"",@progbits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file "main.c" | |
.section .rodata.str1.1,"aMS",@progbits,1 | |
.LC0: | |
.string "%d!\n" | |
.section .text.startup,"ax",@progbits | |
.globl main | |
.type main, @function | |
main: | |
.LFB0: | |
.cfi_startproc | |
pushq %rax | |
.cfi_def_cfa_offset 16 | |
call foo | |
movl $.LC0, %edi | |
movl %eax, %esi | |
xorl %eax, %eax | |
call printf | |
xorl %eax, %eax | |
popq %rdx | |
.cfi_def_cfa_offset 8 | |
ret | |
.cfi_endproc | |
.LFE0: | |
.size main, .-main | |
.ident "GCC: (GNU) 4.8.3 20140624 (Red Hat 4.8.3-1)" | |
.section .note.GNU-stack,"",@progbits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment