delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/24/17:39:35

Date: Sun, 24 Jun 2001 17:38:16 -0400
Message-Id: <200106242138.RAA18013@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <9dde68b7.0106241053.2a385311@posting.google.com>
(zacharyshort AT hotmail DOT com)
Subject: Re: DJGPP reserves wrong int size
References: <9dde68b7 DOT 0106241053 DOT 2a385311 AT posting DOT google DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 00000000 55                          push ebp
> 00000001 89E5                        mov ebp,esp
> 00000003 83EC04                      sub esp,byte +0x18
> 00000006 C745FC78563412              mov dword [ebp-0x4],0x12345678
> 0000000D C9                          leave
> 0000000E C3                          ret
> 
> The third line reserves 18 bytes.
> And it should reserve 4 bytes because thats the size of an int right?
> If you declare a char it still reserves 18 bytes.
> Could someone tell me what's going on?  I am loosing my mind!
> Line 4 is correct though.

The purpose of that is to keep the stack aligned to a 32 byte
boundary, which improves performance on today's high-end processors.

  4 (the call) + 4 (the push) + 24 (the sub) = 32

You can change that with command line options (-mpreferred-stack-boundary=)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019