Summary: 'C', is it's grammar context sensitive ?
Henry Spencer
henry at zoo.toronto.edu
Sat Sep 1 02:31:50 AEST 1990
In article <1990Aug30.223440.7377 at NCoast.ORG> ramsey at 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 at zoo.toronto.edu utzoo!henry
More information about the Comp.lang.c
mailing list