delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/24/16:30:05

From: "Grzegorz Sakrejda" <sakrejda AT pacbell DOT net>
Newsgroups: comp.os.msdos.djgpp,comp.lang.c++,comp.lang.c
References: <9dde68b7 DOT 0106241053 DOT 2a385311 AT posting DOT google DOT com>
Subject: Re: DJGPP reserves wrong int size
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <%%rZ6.3213$CX6.82888@news.pacbell.net>
Date: Sun, 24 Jun 2001 13:22:49 -0700
NNTP-Posting-Host: 64.164.9.79
X-Complaints-To: abuse AT pacbell DOT net
X-Trace: news.pacbell.net 993414267 64.164.9.79 (Sun, 24 Jun 2001 13:24:27 PDT)
NNTP-Posting-Date: Sun, 24 Jun 2001 13:24:27 PDT
Organization: SBC Internet Services
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"ZMAN" <zacharyshort AT hotmail DOT com> wrote in message
news:9dde68b7 DOT 0106241053 DOT 2a385311 AT posting DOT google DOT com...
> Please consider the following code:
>
> int main ()
> {
> int i;
> i = 0x12345678;
> }
>
> -Yes I am aware there is no return statement even if I do have it in there
> it still messes up.
> When I compile this code using:
>
> gcc -c test.c
> ld -o test -Ttext 0x0 -e main test.o
> objcopy -R .note -R .comment -S -O binary test test.bin
>
> and disassemble it I get the following:
>
>
> 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.
>
> I am compiling this on Windows 98 and ME boxes and still get the same
results.
> The gcc version number is 2.953
> binutills is version 2.11
>
> thanks for any help
>

And what's your C++ question ?

 grzegorz


- Raw text -


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