lkml.org 
[lkml]   [2001]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [OT?] Coding Style
    On Mon, Jan 22, 2001 at 11:56:40PM +0000, Anton Altaparmakov wrote:
    > At 16:42 22/01/2001, Mark I Manning IV wrote:
    > >Stephen Satchell wrote:
    > > > I got in the habit of using
    > > > structures to minimize the number of symbols I exposed. It also
    > > > disambiguates local variables and parameters from file- and program-global
    > > > variables.
    > >
    > >explain this one to me, i think it might be usefull...
    >
    > What might be meant is that instead of declaring variables my_module_var1,
    > my_module_var2, my_module_var3, etc. you declare a struct my_module { var1;
    > var2; var3; etc. }. Obviously in glorious technicolour formatting... (-;
    > That's my interpretation anyway...

    Mine too and I think it's a good idea. I have code in BitKeeper where I
    both did and did not do that for command line options and I much prefer
    the structure version.

    Another habit I used to use and have fallen out of, which is a bad idea, is
    one where you use a prefix in stucture files so that you can see
    the difference between

    p->st_mode
    and
    p->f_mode

    In other words, the prefix implies the structure name. Early versions of the
    C compiler had all structure fields (I mean _all_) in one name space so this
    wasn't style, it was required. I must say that it makes code more readable.
    --
    ---
    Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
    -
    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 13:17    [W:0.029 / U:30.720 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site