From owner-cvs-all Fri Jul 23 11:27:12 1999 Delivered-To: cvs-all@freebsd.org Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.26.10.9]) by hub.freebsd.org (Postfix) with ESMTP id 52B26154AF; Fri, 23 Jul 1999 11:27:06 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id EAA10179; Sat, 24 Jul 1999 04:26:53 +1000 Date: Sat, 24 Jul 1999 04:26:53 +1000 From: Bruce Evans Message-Id: <199907231826.EAA10179@godzilla.zeta.org.au> To: bde@zeta.org.au, sgk@troutmask.apl.washington.edu Subject: Re: cvs commit: src/usr.sbin/inetd builtins.c Cc: cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, gibbs@caspian.plutotech.com, green@FreeBSD.ORG Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk >> >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