[lkml]   [2002]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subjectunhappy with current.h
    I recently wrote a kernel module which gave me some mysterious problems.
    After too many days spent in blood, sweat and tears, I found the cause:

    *** one of my data structures has a field named 'current'. ***

    Pretty common word, isn't it? Would you think it can cause such a
    trouble? But in some of my files I happen to indirectly include
    <asm/current.h> (kernel 2.4.18 for i386), containing the following line:

    #define current get_current()

    so that my structure becomes the owner of a function it has never asked
    for, while it looses a data member. gcc has nothing to complain about

    In some other files I don't happen to include <asm/current.h>, so that
    there my structure is sound - but alas! has different size and different
    composition. Again, gcc has nothing to complain.

    Moral of the story: in my opinion kernel developers should reduce to a
    minimum the use of #define, and preferably use words in uppercase and/or
    with underscores, in any case not commonly used words.
    In the specific case the said #define just looks to save 6 keystrokes
    and I think it could have been completely avoided.

    Regards, Daniele Lugli
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:30    [W:0.032 / U:1.828 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site