Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 + RN 4.3; site inset.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!mcvax!ukc!stc!inset!mikeb From: mikeb@inset.UUCP (Mike Banahan) Newsgroups: net.lang.c Subject: Re: Forward Referencing of Static Variables OK? Message-ID: <717@inset.UUCP> Date: Tue, 8-Oct-85 06:14:43 EDT Article-I.D.: inset.717 Posted: Tue Oct 8 06:14:43 1985 Date-Received: Fri, 11-Oct-85 08:36:37 EDT References: <365@tekcbi.UUCP> Reply-To: mikeb@inset.UUCP (Mike Banahan) Organization: The Instruction Set Ltd., London, UK. Lines: 42 Xpath: stc stc-a The orginal article asked what should happen in this sort of case: /***********************************/ extern int xxx; f(){ xxx = 1; } static int xxx; /* `extra' information about xxx */ /***********************************/ The ANSI committee had a lot of work to do on this one. There is an even worse issue than that: /***********************************/ f(){ { extern int xxx; /* OH BOY!!! - where am I visible? */ /* Am I really extern? */ } } y(){ /* can I use xxx in here ???? */ } /***********************************/ They had to come up with a lot of words to fix that stuff - basically, it just wan't written down anywhere what was supposed to happen. Bill Plauger described the whole mess as ``Driving a coach and horses through block structure.'' The more I look at it, the more I agree. X3J11 has come up with a set of answers on what should happen. Because nobody really ``knew'' before, you just get what your compiler happens to give you. Be warned - it is *highly* nonportable practice, because different compilers currently do different things. This is one area where the language was already broken. The standard has chosen one way of patching it. -- Mike Banahan, Technical Director, The Instruction Set Ltd. mcvax!ukc!inset!mikeb