From owner-freebsd-chat Mon Jul 23 10:33:40 2001 Delivered-To: freebsd-chat@freebsd.org Received: from probity.mcc.ac.uk (probity.mcc.ac.uk [130.88.200.94]) by hub.freebsd.org (Postfix) with ESMTP id E18AB37B401 for ; Mon, 23 Jul 2001 10:33:34 -0700 (PDT) (envelope-from jcm@freebsd-uk.eu.org) Received: from dogma.freebsd-uk.eu.org ([130.88.200.97] ident=root) by probity.mcc.ac.uk with esmtp (Exim 2.05 #7) id 15OjaF-0002F8-00 for freebsd-chat@freebsd.org; Mon, 23 Jul 2001 18:33:31 +0100 Received: (from jcm@localhost) by dogma.freebsd-uk.eu.org (8.11.3/8.11.1) id f6NHXVZ55151 for freebsd-chat@freebsd.org; Mon, 23 Jul 2001 18:33:31 +0100 (BST) (envelope-from jcm) Date: Mon, 23 Jul 2001 18:33:31 +0100 From: j mckitrick To: freebsd-chat@freebsd.org Subject: stack use preference Message-ID: <20010723183331.A55127@dogma.freebsd-uk.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org For those of you who write or at one time wrote assembly language programs for the x86 cpus, what is your preference for local variable on the stack? Do you (a) push the esp down, then move esp to ebp and allocate memory for local vars above the esp? (b) move esp to ebp first, then push the esp down (c) real programmers don't need ebp for local vars. They calculate offsets from esp on the fly. :-) It seems (a) would be easier for humans, since all offsets, including procedure parameters, would be positive. However, compilers seem to generate type (b), so parameters are positive offsets from ebp, and local vars are negative. jcm -- o-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-o | ~~~~~~~~~~~~ Jonathon McKitrick ~~~~~~~~~~~~~ | | "I prefer the term 'Artificial Person' myself." | o-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-o To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message