X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Date: Fri, 08 Feb 2002 09:48:56 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <7484-Fri08Feb2002094855+0200-eliz@is.elta.co.il> X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <3C63319A.2E193983@yahoo.com> (message from CBFalconer on Fri, 08 Feb 2002 06:00:06 GMT) Subject: Re: Alignment problem References: <3C629769 DOT AEAFB611 AT cyberoptics DOT com> <3C62A89A DOT 9DF630C5 AT yahoo DOT com> <3C630FB1 DOT E69F87A AT cyberoptics DOT com> <3C63319A DOT 2E193983 AT yahoo 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 Precedence: bulk > From: CBFalconer > Newsgroups: comp.os.msdos.djgpp > Date: Fri, 08 Feb 2002 06:00:06 GMT > > > > It looks as if the integer conversion is multiplying by 10 and adding 6. > > > > I don't see how you came to that conclusion. Neither do I. > Who knows what goes on in the printf conversion and the cast. IT > IS ILLEGAL. ??? Why? Casting a pointer to an int does nothing on x86. It is certainly not illegal in C. > So the system can output anything it feels like. That's simply false. In any case, we have the sources to the library, so we can certainly say what should be output in this specific case. > Note that the %p specification outputs are reasonable, and always 8 > byte aligned. So are the values after the cast. > c:\dnld\scratch>a > ptr 205d8 is 8-byte aligned. (int)p = 1325686 The value 1325686 is 132568 with 6 appended to it. 132568 is the decimal representation of the hex 205d8. 6 is there because your program, for some reason that evades me, appends a 6 to each number: > printf(" ptr %p is %2d-byte aligned. (int)p = %d6\n", So my conclusion is that pointers are 8-byte aligned both before and after the cast, for the program you wrote. > 0x205d8 * 10 + 6 = 1325686, for example. What does this example supposed to show?