Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Summary: 'C', is it's grammar context sensitive ?
Message-ID: <1990Aug31.163150.10831@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <1990Aug30.223440.7377@NCoast.ORG>
Date: Fri, 31 Aug 90 16:31:50 GMT

In article <1990Aug30.223440.7377@NCoast.ORG> ramsey@NCoast.ORG (Cedric Ramsey) writes:
>I don't have the ansi draft; only K&R2. K&R2 doesn't mention, at least
>I don't recall reading it, that typedef names must occur before they are
>used so these points a purely speculative...

A careful reading of section A11.1 of K&R2 will answer these questions.

>...doesn't specify if the following is legal:
>
>typedef unsigned char uchar_t;
>uchar_t uchar_t;
>
>I would say that this is illegal, even though uchar_t is not a keyword.
>Why, because ... I don't know, maybe because it would be harder to parse.

Typedefs *are* hard to parse.  Unfortunately, this particular abomination
is legal... *if* you put a "{" between the two declarations.  It is not
legal to redeclare uchar_t in the same scope as its original declaration,
but redeclaring it inside a block is legal.  Parsing this is no fun at all.
-- 
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday|  henry@zoo.toronto.edu   utzoo!henry
