Information hiding

Chris Torek chris at mimsy.UUCP
Wed Apr 27 12:49:15 AEST 1988


In article <10576 at steinmetz.ge.com> davidsen at steinmetz.ge.com
>  One of the things which bothers me about the C language is that many
>(most) compilers, and lint, complain about taking the address on an
>array.

The dpANS requires that &arr be allowed; it produces a pointer to
the array, i.e., an object whose type is `pointer to T1', where T1 is
the type of arr, `array N of T2'.

I have not tried it, but I suspect that PCC can be changed to conform
to this rule by removing one test.  In cgram.y, somewhere around line
690, there is a rule for `AND term' that begins with

		={  if( ISFTN($2->in.type) || ISARY($2->in.type) ){
			werror( "& before array or function: ignored" );
			$$ = $2;
			}
		    else if( $2->in.op == UNARY MUL &&

Changing this to

		={  if( ISFTN($2->in.type) ){
			werror( "& before function: ignored" );
			$$ = $2;
			}
		    else if( $2->in.op == UNARY MUL &&

ought to do it.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list