In article <tn5audytdrmhii4246bggxerntozvptppffk3mmzcqrp2src4i@eyr4thc5xlcx>,
J. Lewis Muir <jlm...@imca-cat.org> wrote:
>(Initially sent to netbsd-docs@ on 2024-11-22, but didn't hear anything,
>so trying this list.)
>
>Hi!
>
>Near the beginning of the "function" function in the NetBSD source code
>style guide
>
> 
>https://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=HEAD&content-type=text/x-cvsweb-markup
>
>it says the following:
>
>  Avoid initializing variables in the declarations; move
>  declarations next to their first use, and initialize
>  opportunistically. This avoids over-initialization and
>  accidental bugs caused by declaration reordering.
>
>Is that a typo in the first sentence; should "move declarations" be
>"move initializations"?  I ask because all of the example functions in
>the style guide seem to have the variable declarations at the beginning
>of the function, not next to their first use.

No, it is correct. It means:

        int foo;
        /* code not using foo*/
        /* code using foo */

sbould become:

        /* code not using foo*/
        int foo;
        /* code using foo */

christos

Reply via email to