ansi weirdness

Larry Jones scjones at thor.UUCP
Mon Sep 10 23:08:51 AEST 1990


In article <11312 at alice.UUCP>, andrew at alice.UUCP (Andrew Hume) writes:
>  	typedef int (*fn)(struct x *);
>  	extern int fn1(struct x *);
>  	extern fn fp = fn1;
> i understand technically (i think) what is going on.
> the first line introduces a type struct x which goes away
> at the end of the prototype and can never be used again.
> my question is why didn't ANSI do what C++ does here and export
> the type up to file scope?

Because the committee got tired of C being an almost block
structured language -- the exceptions are very difficult to
describe concisely and completely -- so they tried to tighten
up the structuring wherever possible.  Since prototypes were
a committee invention, they got tight scoping rules.  Making
exceptions to the rules when it's convenient to do so may
seem like a good idea at the time, but it just causes a great
deal of pain and aggravation when you have to explain just
exactly when the exceptions occur and what they do.
----
Larry Jones                         UUCP: uunet!sdrc!thor!scjones
SDRC                                      scjones at thor.UUCP
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
You can never really enjoy Sundays because in the back of your
mind you know you have to go to school the next day. -- Calvin



More information about the Comp.std.c mailing list