분류 | 게시판 |
베스트 |
|
유머 |
|
이야기 |
|
이슈 |
|
생활 |
|
취미 |
|
학술 |
|
방송연예 |
|
방송프로그램 |
|
디지털 |
|
스포츠 |
|
야구팀 |
|
게임1 |
|
게임2 |
|
기타 |
|
운영 |
|
임시게시판 |
|
void func(void) {
int blahblah = 1;
blahblah++;
}
int main() {
func(152);
return 0;
}
WhoAmI$ gcc -O0 -std=c99 argvoid.c -o argvoid
argvoid.c:8:7: error: too many arguments to function call, expected 0, have 1
func(152);
~~~~ ^~~
argvoid.c:2:1: note: 'func' declared here
void func(void) {
^
1 error generated.
void func() {
int blahblah = 1;
blahblah++;
}
int main() {
func(153, 154, 155);
return 0;
}
WhoAmI$ gcc -O0 -std=c99 argnothing.c -o argnothing
argnothing.c:8:20: warning: too many arguments in call to 'func'
func(153, 154, 155);
~~~~ ^
1 warning generated.
int main() {
int a = 152 + 312;
return 0;
}
int main(void) {
int a = 152 + 312;
return 0;
}
emptymain`main:
-> 0x100000f80: pushq %rbp
0x100000f81: movq %rsp, %rbp
0x100000f84: movl $0x0, %eax
0x100000f89: movl $0x0, -0x4(%rbp)
0x100000f90: movl $0x1d0, -0x8(%rbp)
0x100000f97: popq %rbp
0x100000f98: retq
voidmain`main:
-> 0x100000f80: pushq %rbp
0x100000f81: movq %rsp, %rbp
0x100000f84: movl $0x0, %eax
0x100000f89: movl $0x0, -0x4(%rbp)
0x100000f90: movl $0x1d0, -0x8(%rbp)
0x100000f97: popq %rbp
0x100000f98: retq
(lldb) bt
* thread #1: tid = 0x44e6e, 0x0000000100000f80 emptymain`main, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x0000000100000f80 emptymain`main
frame #1: 0x00007fff98dd35c9 libdyld.dylib`start + 1
(lldb) r 'testempty'
Process 33860 launched: '/Users/WhoAmI/llvm/emptymain' (x86_64)
Process 33860 stopped
* thread #1: tid = 0x4764c, 0x0000000100000f80 emptymain`main, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100000f80 emptymain`main
emptymain`main:
-> 0x100000f80: pushq %rbp
0x100000f81: movq %rsp, %rbp
0x100000f84: movl $0x0, %eax
0x100000f89: movl $0x0, -0x4(%rbp)
(lldb) x/12xw $rsp
0x7fff5fbffbb8: 0x98dd35c9 0x00007fff 0x98dd35c9 0x00007fff
0x7fff5fbffbc8: 0x00000000 0x00000000 0x00000002 0x00000000
0x7fff5fbffbd8: 0x5fbffce0 0x00007fff 0x5fbffcfd 0x00007fff
(lldb) x/s 0x7fff5fbffcfd
0x7fff5fbffcfd: "testempty"
(lldb) r 'testvoid'
Process 33865 launched: '/Users/WhoAmI/llvm/voidmain' (x86_64)
Process 33865 stopped
* thread #1: tid = 0x47677, 0x0000000100000f80 voidmain`main, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
frame #0: 0x0000000100000f80 voidmain`main
voidmain`main:
-> 0x100000f80: pushq %rbp
0x100000f81: movq %rsp, %rbp
0x100000f84: movl $0x0, %eax
0x100000f89: movl $0x0, -0x4(%rbp)
(lldb) x/12xw $rsp
0x7fff5fbffbc8: 0x98dd35c9 0x00007fff 0x00000000 0x00000000
0x7fff5fbffbd8: 0x00000002 0x00000000 0x5fbffce8 0x00007fff
0x7fff5fbffbe8: 0x5fbffd04 0x00007fff 0x00000000 0x00000000
(lldb) x/s 0x7fff5fbffd04
0x7fff5fbffd04: "testvoid"
죄송합니다. 댓글 작성은 회원만 가능합니다.