2014-07-06 :-)
_ Gmail を Bekcy! でアクセスするようにしてみた
んだが Becky! が割りとよく刺さるので快適とはあまり言えない。
_ C のラベルのスコープ
スコープは関数内らしい Scope and Visibility
$ gcc --version gcc (GCC) 4.8.2
#include <stdio.h> void func0(void) { goto label1; label1: printf("func0\n"); } void func1(void) { goto label1; label1: printf("func1\n"); } int main(int ac, char** av) { func0(); func1(); }
$ gcc -S label0.c
眺める。そもそも label1 という名前が消えておる。seh_proc が何なのか分からんけど(ググっても分からん) これが関数とラベル(というかアドレス?)を結びつけているのかしら。
.file "label0.c" .section .rdata,"dr" .LC0: .ascii "func0\0" .text .globl func0 .def func0; .scl 2; .type 32; .endef .seh_proc func0 func0: pushq %rbp .seh_pushreg %rbp movq %rsp, %rbp .seh_setframe %rbp, 0 subq $32, %rsp .seh_stackalloc 32 .seh_endprologue nop .L2: leaq .LC0(%rip), %rcx <= .LOC0 のアドレスを rcx へロードして call puts <= puts を呼び出す nop addq $32, %rsp popq %rbp ret .seh_endproc .section .rdata,"dr" .LC1: .ascii "func1\0" .text .globl func1 .def func1; .scl 2; .type 32; .endef .seh_proc func1 func1: pushq %rbp .seh_pushreg %rbp movq %rsp, %rbp .seh_setframe %rbp, 0 subq $32, %rsp .seh_stackalloc 32 .seh_endprologue nop .L4: leaq .LC1(%rip), %rcx call puts nop addq $32, %rsp popq %rbp ret .seh_endproc .def __main; .scl 2; .type 32; .endef .globl main .def main; .scl 2; .type 32; .endef .seh_proc main main: pushq %rbp .seh_pushreg %rbp movq %rsp, %rbp .seh_setframe %rbp, 0 subq $32, %rsp .seh_stackalloc 32 .seh_endprologue movl %ecx, 16(%rbp) movq %rdx, 24(%rbp) call __main call func0 call func1 addq $32, %rsp popq %rbp ret .seh_endproc .ident "GCC: (GNU) 4.8.2" .def puts; .scl 2; .type 32; .endef
[ツッコミを入れる]