Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jul 1999 04:26:53 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, sgk@troutmask.apl.washington.edu
Cc:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, gibbs@caspian.plutotech.com, green@FreeBSD.ORG
Subject:   Re: cvs commit: src/usr.sbin/inetd builtins.c
Message-ID:  <199907231826.EAA10179@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> >semantically limiting the scope of the variable to just the area where it
>> >is used is, IMO, advantageous from a maintenance standpoint.
>> 
>> Nevertheless, it is explicitly forbidden in style(9) (except in
>> "unusually complicated" routines).
>> 
>
>Where?  I just read style(9),  I can only find
>
>     When declaring variables in functions declare them sorted by size, then
>     in alphabetical order; multiple ones per line are okay.  Declaring func-
>     tions inside functions is not recommendable, since their linkage scope is
>     always global.  If a line overflows reuse the type keyword.

     Parts of a for loop may be left empty.  Don't put declarations inside
     blocks unless the routine is unusually complicated.

>I also note that the "sorted by size" doesn't indicate whether
>smallest comes first or last (although the example does suggest
>the order).

"Sorted by size" means largest first, at least in structs.  This tends
to give the least padding in structs.  For local variables it has little
or no effect.  gcc normally sorts local variables with largest variables
at the bottom of the stack.  I think this is to optimise locality.  It
pessimises instruction sizes on i386's.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907231826.EAA10179>