Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: Notesfiles $Revision: 1.6.2.17 $; site convex.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!mhuxn!houxm!ihnp4!inuxc!pur-ee!uiucdcs!convex!graham
From: graham@convex.UUCP
Newsgroups: net.lang.c
Subject: PCC <-> scope rules for "typedef" ??
Message-ID: <37300004@convex.UUCP>
Date: Mon, 3-Dec-84 11:29:00 EST
Article-I.D.: convex.37300004
Posted: Mon Dec  3 11:29:00 1984
Date-Received: Tue, 4-Dec-84 09:03:55 EST
Lines: 24
Nf-ID: #N:convex:37300004:000:990
Nf-From: convex!graham    Dec  3 10:29:00 1984

The following small C program (complete with error messages inserted by
"error") illustrates that "typedef" does not obey the scope rules for
declarations in the portable C compiler.  K&R says (in paragragh 11.1,
page 206) that "typedef names are in the same class as ordinary identifiers.",
and proceeds to give an example very much like that given below.
Since re-declaring a typedef names fails in PCC, it can't occur in any programs
compiled with PCC.  Are there any widely used C compilers which permit
redeclaration of a typedef name?  Should new, "standard" C compilers implement
this feature?

typedef int intType ;

x(i)
  intType i ;
/*###5 [cc] illegal type combination%%%*/
{ char intType ; /* <<<< Can't re-declare 'intType' in a new scope */
  int(j) ;	/* looks strange, but means the same as "int j ;" */
/*###7 [cc] syntax error%%%*/
/*###7 [cc] warning: old-fashioned initialization: use =%%%*/
  long(intType) ; /* <<<< "extra" parens cause a different problem */

  ; 
}