Mail Archives: djgpp/2002/02/08/02:55:28
> From: CBFalconer <cbfalconer AT yahoo DOT com>
> 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?
- Raw text -