From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4873305131bf4d94 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public From: seebs@plethora.net (Peter Seebach) Subject: Re: Mixing declarations and statements (Re: Porting (was ADA and Pascal etc)) Date: 1997/11/05 Message-ID: <63ocvc$835$2@darla.visi.com>#1/1 X-Deja-AN: 287063995 References: <34557f2b.1934172@news.mindspring.com> <63nlk6$h0e$1@darla.visi.com> <345F6265.A505E2FC@earthling.net> Organization: Plethora Internet NNTP-Posting-Date: 04 Nov 1997 18:00:44 CST Newsgroups: comp.lang.ada,comp.lang.c Date: 1997-11-04T18:00:44-06:00 List-Id: In article <345F6265.A505E2FC@earthling.net>, Charles Hixson wrote: >Actually, I believe that it's worse than that. The variables are >allocted at run time, so if the first case doesn't end with a break, >then if you follow the path through the first case, then the second case >MUST NOT declare the int, but only use it. However if you follow the >path directly through the second case, then the second case MUST delcare >the int. No. To the best of my knowledge, the rule is that any line of code which, if there were no jumps, is in the scope for a variable has that variable in scope, although an initializer may not occur unless control passes through the declaration. >And this can only be detected at run-time (I hope I'm wrong >about this. It's been a few of years since I did any significant amout >of C programming, and I stayed away from this kind of construct then, >but that's the way I remember it). I believe you're wrong; the initialization is up in the air, but the declaration works sensibly. -s -- seebs@plethora.net -- Speaking for myself. No spam please. Copyright 1997. All rights reserved. This was not written by my cat. C/Unix wizard - send mail for help! -- - More Net, Less Spam!