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: > 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 = 0xbfbd72a0 cip = 0xbfbd72a0 ip = 0xbfbd72a0 > >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >>> > >>> The global variable code would segfault, as I expected. But the > >>> auto variable code gives this illogical result. I would appreciate > >>> comments. I am not on this list, so please ensure I am cc'd with > >>> any responses. I'll be happy to file a bug, if it is a bug. > >> Modifying a variable which is declared const is undefined behaviour. > >> You can not predict what happens. > > > 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. > > Your opinion about undefined behaviour is not shared by the C > Standard committee: undefined code may do anything. As the > saying goes, "Demons might fly our of your nose." > > > But to let the buggy code execute with addresses that are not > > accurate is a liberty I would hope could have been avoided. It > > just looks bad. I do realize, no one should have a gripe, because > > the code is buggy to begin with. But addresses should always be > > reported accurately IMHO. Of course, I obviously know nothing > > about compilers. (smiles ;) > > For what it's worth, this is a common misunderstanding. A proper > understanding of the true meaning of "undefined behaviour" comes > later. > > Andrew. ---end quoted text--- -- Karen Shaeffer Neuralscape, Palo Alto, Ca. 94306 [EMAIL PROTECTED] http://www.neuralscape.com