Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!tness7!texbell!bigtex!james From: james@bigtex.uucp (James Van Artsdalen) Newsgroups: comp.sys.ibm.pc Subject: Re: Function declarations Message-ID: <7528@bigtex.uucp> Date: 4 Sep 88 23:40:30 GMT References: <10102@genrad.UUCP> <11879@iuvax.cs.indiana.edu> <5680@rpp386.UUCP> <1275@mcgill-vision.UUCP> <13344@mimsy.UUCP> <697@proxftl.UUCP> Reply-To: james@bigtex.UUCP (James Van Artsdalen) Organization: F.B.N. Software, Austin TX Lines: 42 In article <697@proxftl.UUCP>, bill@proxftl.UUCP (T. William Wells) wrote: > All in the name of easing a few implementers' lives. > Shame on you X3J11. > [...] who should have to deal with the pain caused by systems that > make one pass compilation difficult: every user of ANSI C, or those > people charged with the writing of a C compiler for those systems? It's worse than all that. ANSI C permits conflicting function declarations without a warning - indeed it is required that no warning be given. For example, consider the following in the context of a far memory model on the 286: int a() { int b(); return b(); } char * b() { return "foo"; } A purely ANSI C compiler must not generate an error according to ANSI C, because the incorrect declaration of b() is hidden within the scope of a(). Yet this program cannot work, and I can't conceive of any implementation where the ANSI C requirement is actually useful. The nature of functions in C is such that the *definitions* cannot be scoped (ie, you can't place a function definition within the scope of another function as you can in Pascal): it is not clear why it is desirable that function *declarations* should be subject to scoping. I too think that the ANSI C committee did a very good job overall. -- James R. Van Artsdalen ...!uunet!utastro!bigtex!james "Live Free or Die" Home: 512-346-2444 Work: 328-0282; 110 Wild Basin Rd. Ste #230, Austin TX 78746