lkml.org 
[lkml]   [2003]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: PCI Express support for 2.4 kernel
    Vladimir Kondratiev wrote:

    > To illustrate zero cost, I did the following test:
    > [tmp]$ cat t.c; gcc -S t.c; cat t.s
    > static int a1=0;
    > static int a2;
    > /* EOF */
    >
    > .file "t.c"
    > .local a1
    > .comm a1,4,4
    > .local a2
    > .comm a2,4,4
    > .section .note.GNU-stack,"",@progbits
    > .ident "GCC: (GNU) 3.3.1 20030811 (Red Hat Linux 3.3.1-1)"
    >
    > As you can see, assembly code is identical, compiler did this trivial
    > optimization for me.

    You've missed the point, though. Initializing a static variable to zero
    causes space to be consumed in the resulting object file (not
    instruction code to be generated). This is wasted space, because if you
    don't initialize to zero the variable will be allocated out of space
    that is _automatically_ zeroed for you. This reduces the size of the
    kernel image by not filling it with unnecessary zeroes.

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:59    [W:3.713 / U:0.112 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site