[comp.lang.c] Another question on X3J11 proposal

lvc@danews.ATT.COM (Larry Cipriani) (12/14/86)

Does the X3J11 proposal allow reuse of names in the following manner?

main(argc, argv)
	int argc;	/* first argc */
	char *argc[];
{
	int argc;	/* second argc */

	printf("argc = %d\n", argc);
}

3 PDP 11/70 compilers I use give the message 'argc redeclared' and
abort. A 3B5 and 3B2 compiler I use allow this.  I believe that the
PDP compilers are correct and the 3b compilers are broken.

Is the scope of the 'second argc' (an automatic) the same as that of
the 'first argc' (a function paramter)?

If the X3J11 proposal allows this I wish to register a formal complaint.
Who do I contact?

-- 

Larry Cipriani	AT&T Network Systems
cbosgd!{danews,cbsck}!lvc

lvc@danews.ATT.COM (Larry Cipriani) (12/16/86)

> Does the X3J11 proposal allow reuse of names in the following manner?
> main(argc, argv) int argc; char *argc[]; /* first argc */ {
> 	int argc;	/* second argc */
> 	printf("argc = %d\n", argc);
> }

Since posting this I've learned that 1) this is has
been addressed in the X3J11 proposal (the scope of
parameters is determined as if they were automatics
declared at the beginning of the first block), 2)
that because of an ambiguity in K&R a compiler may
allow this (yuck!) or not.
-- 

Larry Cipriani	AT&T Network Systems
cbosgd!{danews,cbsck}!lvc

meissner@dg_rtp.UUCP (Michael Meissner) (12/17/86)

In article <362@danews.ATT.COM> lvc@danews.ATT.COM (Larry Cipriani) writes:
>
> Does the X3J11 proposal allow reuse of names in the following manner?
>
> main(argc, argv)
>	int argc;	/* first argc */
>	char *argc[];
> {
>	int argc;	/* second argc */
>
>	printf("argc = %d\n", argc);
> }
>
> 3 PDP 11/70 compilers I use give the message 'argc redeclared' and
> abort. A 3B5 and 3B2 compiler I use allow this.  I believe that the
> PDP compilers are correct and the 3b compilers are broken.

The current X3J11 proposal does not allow the redeclaration (because
parameters are considered to be in the same logical scope).
--
	Michael Meissner, Data General
	...mcnc!rti-sel!dg_rtp!meissner

-- 
	Michael Meissner, Data General
	...mcnc!rti-sel!dg_rtp!meissner