Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!necntc!ima!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: Implementation-DEPENDENT code (was:strcpy) Message-ID: <19160@think.UUCP> Date: 8 Apr 88 07:35:34 GMT References: <7712@apple.Apple.Com> <7485@brl-smoke.ARPA> <10731@mimsy.UUCP> <7506@brl-smoke.ARPA> <4251@hoptoad.uucp> <6286@dhw68k.cts.com> <4215@ihlpf.ATT.COM> <6476@dhw68k.cts.com> <4309@ihlpf.ATT.COM> <4331@ihlpf.ATT.COM> Sender: usenet@think.UUCP Reply-To: barmar@fafnir.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 23 In article <4331@ihlpf.ATT.COM> nevin1@ihlpf.UUCP (00704a-Liber,N.J.) writes: [Example of code that depends on old value of a variable from the previous time a block was exited.] >The reason is that j is declared inside a block, and this block is entered >and exited through each iteration of the while loop. I know of one implementation where that example probably won't work, although I haven't tried it yet. The Symbolics C compiler initializes automatic variables that do not have an explicit initializer) to a special "undefined" value, and traps attempts to take the value. The compiler also does a little flow analysis and warns you if it looks like your code references a variable before setting it (unfortunately, it is a bit overeager in this regard, and warns about some cases that are obviously valid to a human reader (note that this comment is based on experience with the beta test version of the compiler, and it may have been improved in the final version)). Barry Margolin Thinking Machines Corp. barmar@think.com uunet!think!barmar