scope of actual parameters

David Keppel pardo at june.cs.washington.edu
Tue Aug 8 01:04:19 AEST 1989


This is a summary of responses.

pardo at june.cs.washington.edu (David Keppel) writes:
| My *impression* is that actual parameter names are local to the
| function.  My dpANS-compliant compiler (gcc version 1.34) complains on
| the following program:
|
|     typedef int foo;
|     m (foo){}
|
|     foo.c: parameter name omitted

The most illuminating comment was Roger Critchlow:

| It's compliant.  There is an ambiguity in the grammar at the point
| where m (foo has been read.  The compiler wants to know whether it
| has read the first identifier in an old style function declaration
| or the type-name of the first parameter in a prototype style function
| declarator.  Rather than forcing the compiler to look ahead further
| to disambiguate, the standard says that a type-name is a type-name
| in this context.

Thanks to all who responeded (and those who have yet to respond :-)
Fooey on inews for rejecting my article the first time, just because
I was trying to show what was quoted text.

	;-D on  ( The great plains: Farm all parameters )  Pardo
-- 
		    pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.std.c mailing list