Xref: utzoo comp.lang.c:31736 comp.std.c:3576 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!sdrc!thor!scjones From: scjones@thor.UUCP (Larry Jones) Newsgroups: comp.lang.c,comp.std.c Subject: Re: ansi weirdness Message-ID: <166@thor.UUCP> Date: 10 Sep 90 13:08:51 GMT References: <11305@alice.UUCP> <11312@alice.UUCP> Followup-To: comp.lang.c Organization: SDRC, Cincinnati Lines: 26 In article <11312@alice.UUCP>, andrew@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@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