Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!hagbard!sunic!mcsun!inria!irisa!ridoux From: ridoux@irisa.fr (Olivier Ridoux) Newsgroups: comp.lang.c Subject: Re: &&** Message-ID: <1990Sep7.080855.24070@irisa.fr> Date: 7 Sep 90 08:08:55 GMT References: <1990Sep7.021321.18381@watmath.waterloo.edu> Sender: news@irisa.fr Organization: IRISA, Rennes (FR) Lines: 47 From article <1990Sep7.021321.18381@watmath.waterloo.edu>, by datanguay@watmath.waterloo.edu (David Adrien Tanguay): > In article <1990Sep6.091605.15732@irisa.fr> ridoux@irisa.fr (Olivier Ridoux) writes: > |`` &^n*^n x '' (`` &*x '', `` &&**x '', `` &&&***x '', ...). > > Also note that the "&&" sequences in the above expressions will lex as > "logical and" operators. I apologize. I should have fully parenthesized all the expressions. Since I was only dealing with operators `` & '' and `` * '' I thought it was unambiguous. `` && '' must not interfer in the game. My question is not on the validity of the composition of the operator `` & ''. It is rather "what is the rational of the cc and gcc compilers (sun4) that makes them accept the following program. Can I expect that every C compiler will have the same rational ? My opinion is that the rational is based on the axiom: `` &(*(x)) = x ''. Note that this axiom is not a consequence of the book (K&R). main() { char c = 'c' ; char * pc = &c ; char ** ppc = &pc ; char d = 'd' ; char * pd = &d ; char ** ppd = &pd ; printf( "%c\n", *(*( &(&(*(*(ppc)))) )) ); /* 1 */ printf( "%c\n", *(*( &(&(*(*(ppd)))) )) ); /* 2 */ &(&(*(*(ppc)))) = ppd ; printf( "%c\n", *(*( &(&(*(*(ppc)))) )) ); /* 3 */ } 1 (and 2) shows that the composition of `` & '' is interpreted by the compiler, though the book says it is not valid because `` & '' requires a lvalue and yields no lvalue. 3 shows that the expression `` &(&(*(*(ppc)))) '' is even an lvalue. I think it is because `` ppc '' is an lvalue. Olivier Ridoux