( Nyosigomboc | 2011. 08. 12., p – 22:28 )


nyos@hex:~/src$ cat sizeofproba.c
#include <stdio.h>

#define BUFSIZE 256

char s[BUFSIZE];

int main()
{
  int con;
  int siz;
  
  con=BUFSIZE-1;
  siz=sizeof(s)-1;
  
  printf("%d %d\n",con,siz);
  
  return 0;
}

nyos@hex:~/src$ cat sizeofproba.s
        .file   "sizeofproba.c"
        .comm   s,256,32
        .section        .rodata
.LC0:
        .string "%d %d\n"
        .text
.globl main
        .type   main, @function
main:
.LFB0:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        movq    %rsp, %rbp
        .cfi_offset 6, -16
        .cfi_def_cfa_register 6
        subq    $16, %rsp
        movl    $255, -4(%rbp)
        movl    $255, -8(%rbp)
        movl    $.LC0, %eax
        movl    -8(%rbp), %edx
        movl    -4(%rbp), %ecx
        movl    %ecx, %esi
        movq    %rax, %rdi
        movl    $0, %eax
        call    printf
        movl    $0, %eax
        leave
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE0:
        .size   main, .-main
        .ident  "GCC: (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2"
        .section        .note.GNU-stack,"",@progbits

Szo nelkul inicializalja 255-tel.