Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site mit-eddie.UUCP Path: utzoo!linus!decvax!harpo!eagle!mhuxl!houxm!ihnp4!mit-eddie!smh From: smh@mit-eddie.UUCP Newsgroups: net.lang.c Subject: Re: & operator Message-ID: <999@mit-eddie.UUCP> Date: Sun, 4-Dec-83 11:47:56 EST Article-I.D.: mit-eddi.999 Posted: Sun Dec 4 11:47:56 1983 Date-Received: Mon, 5-Dec-83 04:50:54 EST References: <162@iwu1a.UUCP> Organization: MIT, Cambridge, MA Lines: 27 char *in; char *out; out = &(*in++); Should "out" be set to "in" or "in + 1?" Upon consideration of the types during the evaluation of the right-hand-side, it seems clear that: - the & operator is applied to the value of the expression inside the parentheses; - that value is type char, and that char is the one pointed to by the original value of in; - the address of that character has type (char *) and indeed is the original value of in. Therefore, the code example ought to be equivalent to: out = in; *in++; The dereferencing of pointer (the '*') seems nugatory, but may have side effects such as causing a segmentation violation or accessing a device register. Different compilers seem to have different opinions. I believe it should be set to "in." If this analysis is correct, which are the compilers with a different opinion? It would be nice to know! Steve Haflich, MIT Experimental Music Studio