From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert de Bath Subject: Re: More dev86 changes (0.16.5) Date: Fri, 26 Jul 2002 08:55:39 +0100 (BST) Sender: linux-8086-owner@vger.kernel.org Message-ID: <6dc1a51a1aac3edd@mayday.cix.co.uk> References: <20020725154219.GA2577@codepoet.org> Mime-Version: 1.0 Return-path: In-Reply-To: <20020725154219.GA2577@codepoet.org> List-Id: Content-Type: TEXT/PLAIN; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Manuel Novoa III Cc: Riley Williams , Linux-8086 On Thu, 25 Jul 2002, Manuel Novoa III wrote: > > One other thing I would like to see, which is an optimising measure more > > than anything: When bcc lays out the variables at any level, if it sorts > > them in descending order of size before laying them out, it will really > > minimise the number of padding bytes needed to ensure correct alignment. > > It is for this reason that when I am writing C code, I always list all > > of the variables in descending size order, > > Same here. ;-) This gains you nothing unless you are in the habit of using single byte char values even then there's gotya ... In 32bit mode int and long are the same size. In 16bit mode everything is aligned on 2 bytes boundries (including the stack). In fact if you put them in _decending_ order of size you may actually be hurting the code because the BP register points at the top (highest memory address) of the current stack frame so the variables defined first have the smallest offsets and can probably be accessed using smaller (and possibly faster) instructions, however, this only applies if the offset exceeds 128 bytes. -- Rob. (Robert de Bath )