lkml.org 
[lkml]   [2000]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] removal of "static foo = 0"
    On Mon, Nov 27, 2000 at 12:39:55AM -0800, David S. Miller wrote:
    > Also I believe linkers are allowed to arbitrarily reorder members in
    > the data and bss sections. I could be wrong on this one though.

    I'm not sure either, but we certainly rely on that behaviour somewhere.
    Just to make an example fs/dquot.c:

    int nr_dquots, nr_free_dquots;

    kernel/sysctl.c:

    {FS_NRDQUOT, "dquot-nr", &nr_dquots, 2*sizeof(int),

    The above is ok also on mips in practice though.

    In 2.2.x there was more of them.

    Regardless if we're allowed to rely on the ordering the above is bad coding
    practice because somebody could forget about the dependency on the ordering and
    put something between nr_dquotes and nr_free_dquotes :), so such dependency
    should be avoided anyways...

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

    \
     
     \ /
      Last update: 2005-03-22 12:47    [W:0.020 / U:119.824 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site