Re: c99/c++ localised variable definition

From: John-Mark Gurney (gurney_j_at_resnet.uoregon.edu)
Date: 02/01/05

  • Next message: Paul Richards: "Re: c99/c++ localised variable definition"
    Date: Tue, 1 Feb 2005 10:06:24 -0800
    To: Paul Richards <paul@originative.co.uk>
    
    

    Paul Richards wrote this message on Mon, Jan 31, 2005 at 10:26 +0000:

    [...]

    > I think the loop usage though is one clear example where it is
    > clearer. I think there are others as well; where the usage of the
    > variable is clearly localised it is much easier to see a local
    > definition than to have to jump back and forth to find out what
    > variables are.

    I personally think it isn't. One thing that I do in python all to
    regularly (because it lacks variable declarations), is attempt to do:
            for i in foo:
                    for j in bar:
                            for i in baz:

    And wonder why i gets such a strange value... It appears that unless
    you have WARNS=4 set, warnings about:
    t.c:10: warning: declaration of 'i' shadows a previous local

    don't show up. So, I would say we HAVE to get the tree building with
    WARNS=4 and -Werror before we let this into style(9)...

    Requiring variables at the top require people to think about variable
    names, and as others have stated, if you need local scoped variables,
    you're probably better off creating a new function.

    /me notes it's anoying that gcc accepts -std=c99 and not -std=C99.

    -- 
      John-Mark Gurney				Voice: +1 415 225 5579
         "All that I will do, has been done, All that I have, has not."
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
    

  • Next message: Paul Richards: "Re: c99/c++ localised variable definition"

    Relevant Pages