Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!utfyzx!sq!msb From: msb@sq.UUCP Newsgroups: comp.lang.c Subject: Re: Comments on ANSI public Oct 86 Public review draft. Message-ID: <1987Mar30.202538.22968@sq.uucp> Date: Mon, 30-Mar-87 20:25:38 EST Article-I.D.: sq.1987Mar30.202538.22968 Posted: Mon Mar 30 20:25:38 1987 Date-Received: Tue, 31-Mar-87 05:32:31 EST References: <4804@brl-adm.ARPA> <365@bms-at.UUCP> <704@mcgill-vision.UUCP> <341@zuring.mcvax.cwi.nl> <157@ohlone.UUCP> Reply-To: msb@sq.UUCP (Mark Brader) Organization: SoftQuad Inc., Toronto Lines: 27 Checksum: 30931 > What is the definition about 'goto' where the target is an enclosed > block? In particular: > ... a = 3; goto l; > ... { int i = a; l: ; printf("%d\n", i); } > is the initializing assignment to i done or not? This is covered in Section 3.1.2.4 of the draft, which reads in part: # A new instance of an object declared with "automatic storage duration" # is created on each normal entry into the block in which it is declared # or on a jump to a label in the block or in an enclosed block. If an # initialization is specified, it is performed on each normal entry, # but not if the block is entered by a jump to a label. In other words, your code fragment is legal (they couldn't really make it illegal, that would break too much existing code), and prints garbage. I'm glad you made me look at that. There are two problems with the above. One is that the words "from outside the block" should be added just after the first "jump". They don't mean that a simple if-goto loop within a block causes new instances of variables in the block to be created on each iteration! The second problem is that there is no back-reference to 3.1.2.4 in section 3.5.6, which is about initialization, nor any index entry for 3.1.2.4 under initialization. Mark Brader, utzoo!sq!msb C unions never strike!