Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!vaxine!wjh12!genrad!decvax!harpo!utah-cs!utah-gr!thomas From: thomas@utah-gr.UUCP (Spencer W. Thomas) Newsgroups: net.lang.c Subject: Re: Must useless expressions be evaluated? Message-ID: <939@utah-gr.UUCP> Date: Thu, 20-Oct-83 00:21:08 EDT Article-I.D.: utah-gr.939 Posted: Thu Oct 20 00:21:08 1983 Date-Received: Mon, 24-Oct-83 23:46:14 EDT References: mit-eddi.818 Lines: 13 But all of these examples (touching and/or reading a location to cause a "trap") can be done in a "non-useless" setting by a statement of the form i := loc; Here, you are assigning the value, and so it is not "useless". In fact, I had exactly that problem in a sort of garbage collector thing I wrote - I wanted to test pointers to see if they really pointed to something before following them. Just saying *ptr was NOT sufficient - the compiler threw it away (I think this was in a comma-separated expression, I'm not sure now). I had to actually assign it to a variable before I could get my "expected" trap (naturally I chose a register variable). =Spencer