Re: auto const ints and pointer issue

2008-06-18 Thread Karen Shaeffer
On Wed, Jun 18, 2008 at 09:41:26AM -0700, Joe Buck wrote: > On Tue, Jun 17, 2008 at 08:51:24PM -0700, Karen Shaeffer wrote: > > I see your point. My sticking point is that the process is actually > > running on a physical machine. > > And that's the problem. You, like many C programmers, have in

Re: auto const ints and pointer issue

2008-06-18 Thread Joe Buck
On Tue, Jun 17, 2008 at 08:51:24PM -0700, Karen Shaeffer wrote: > I see your point. My sticking point is that the process is actually > running on a physical machine. And that's the problem. You, like many C programmers, have in your head a physical machine model where pointer variables are physi

Re: auto const ints and pointer issue

2008-06-18 Thread Karen Shaeffer
Hi, Hahaha! I know, I have been getting an education here. I really appreciate everyone's patience on this issue. I have assimilated all the excellent comments and understand my own laziness has caused my confusion. Thank you all. Karen On Wed, Jun 18, 2008 at 11:20:00AM +0100, Andrew Haley wrote:

Re: auto const ints and pointer issue

2008-06-18 Thread jlh
Hi! Karen Shaeffer wrote: I see your point. My sticking point is that the process is actually running on a physical machine. And the addresses, although virtual, do translate to a unique physical memory location. And, the value stored in that location cannot be 0 and 5 at the same time. And my c

Re: auto const ints and pointer issue

2008-06-18 Thread Andrew Haley
Karen Shaeffer wrote: > On Tue, Jun 17, 2008 at 11:01:31AM -0700, Ian Lance Taylor wrote: >>> >>> output ~~ >>> $ const_ints >>> const int ic = 0 *cip = 5 *ip = 5 >>> &ic = 0xbfbd72a0cip =

Re[2]: auto const ints and pointer issue

2008-06-17 Thread Dmitry I. Yanushkevich
Hello Karen, Tuesday, June 17, 2008, 10:38:20 PM, you wrote: > Hi Ian, I can live with that. My problem was that the addresses > cannot be correct. In my opinion, the undefined behavior should be > limited to the value in the address or in some form of error. But to > let the buggy code ex

Re: auto const ints and pointer issue

2008-06-17 Thread Ian Lance Taylor
Karen Shaeffer <[EMAIL PROTECTED]> writes: > I see your point. My sticking point is that the process is actually > running on a physical machine. And the addresses, although virtual, > do translate to a unique physical memory location. And, the value > stored in that location cannot be 0 and 5 at

Re: auto const ints and pointer issue

2008-06-17 Thread Karen Shaeffer
On Tue, Jun 17, 2008 at 09:52:17PM -0400, Andrew Pinski wrote: > On Tue, Jun 17, 2008 at 9:44 PM, Karen Shaeffer > <[EMAIL PROTECTED]> wrote: > > On Tue, Jun 17, 2008 at 11:01:31AM -0700, Ian Lance Taylor wrote: > >> > output ~~ > >> > $ const_ints > >>

Re: auto const ints and pointer issue

2008-06-17 Thread Andrew Pinski
On Tue, Jun 17, 2008 at 9:44 PM, Karen Shaeffer <[EMAIL PROTECTED]> wrote: > On Tue, Jun 17, 2008 at 11:01:31AM -0700, Ian Lance Taylor wrote: >> > output ~~ >> > $ const_ints >> > const int ic = 0 *cip = 5 *ip = 5 >> > &ic = 0xbfbd72a0cip = 0xbf

Re: auto const ints and pointer issue

2008-06-17 Thread Karen Shaeffer
On Tue, Jun 17, 2008 at 11:01:31AM -0700, Ian Lance Taylor wrote: > > output ~~ > > $ const_ints > > const int ic = 0 *cip = 5 *ip = 5 > > &ic = 0xbfbd72a0cip = 0xbfbd72a0ip = 0xbfbd72a0 > > ~~

Re: auto const ints and pointer issue

2008-06-17 Thread Karen Shaeffer
On Tue, Jun 17, 2008 at 11:01:31AM -0700, Ian Lance Taylor wrote: > > > > output ~~ > > $ const_ints > > const int ic = 0 *cip = 5 *ip = 5 > > &ic = 0xbfbd72a0cip = 0xbfbd72a0ip = 0xbf

Re: auto const ints and pointer issue

2008-06-17 Thread Ian Lance Taylor
Karen Shaeffer <[EMAIL PROTECTED]> writes: > int main(int argc, char * argv[]) { > const int ic = 0; > const int * cip; > int * ip; > cip = ⁣ > ip = (int *)cip; > *ip = 5; > printf("const int ic = %d *cip = %d *ip = %d\n", ic, *cip, *ip); > printf("&ic = %pcip = %pip =

auto const ints and pointer issue

2008-06-17 Thread Karen Shaeffer
Hi, I have stumbled upon a quirk that appears to me to be illogical. Maybe someone can help me to understand this: sample code ~ #include const int gic = 0; const int * gcip; int * gip; int main(int argc, char * argv[]) { const int ic = 0; const int