This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/5219: Wishlist : scope of typedef doesnt include typedef itself



>Number:         5219
>Category:       c
>Synopsis:       Wishlist : scope of typedef doesnt include typedef itself
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 29 14:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Siward de Groot <siward.de.groot@worldonline.nl>
>Release:        all
>Organization:
>Environment:
all
>Description:
Hi !

I would like this code to work :

typedef struct {
  treenode * prev ;
  treenode * next ;
  char     * ball ;
  } treenode ;

I know I can change first line to give struct a name,
  but this name I never need,
  and I like my code to be clean.
As typedef defines a new name for an existing type,
  why not give that type its desired name directly ?

>How-To-Repeat:

>Fix:
I dont know internals of compiler.
I think that,
  since struct definition is inside typedef, and
  since this construct is valid if struct is named,
  solution might be :
    when parsing a typedef,
    first reserve a place where that type can be  specified
    fill in name to be typedef'd,
      and after that parse struct definition as usual.
This should present no problems (tm), since
  name is known, and
  it only needs to work for pointer types, who's size is known.

If I can do anything to help, please let me know.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]