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 = 0xbfbd72a0 cip = 0xbfbd72a0 ip = 0xbfbd72a0 >> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> In my opinion, it seems reasonable to limit the undefined > behavior to the value of the variable, or to some form of > failure and error, up to and including crashing the process. > But to implement the code in such a way to let the process > proceed without error, and to have incorrect addresses as we > see here, seems to be beyond the common sense scope of the bounds > of what this assignment's undefined behavior potential effects > might be. It is interesting. Thank you for your comment.
I don't see the issue with the pointers being the same. I don't see what you are asking to be different. Casting from one pointer type to another is ok. So we can go from: cip = ⁣ ip = (int *)cip; cip = ip; And cip should be the same as &ic at the end of that code sequence. Thanks, Andrew Pinski