Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.lang.c Subject: Re: ANSII C, optimization, and "hardware registers" Message-ID: <4453@utzoo.UUCP> Date: Sat, 13-Oct-84 19:27:14 EDT Article-I.D.: utzoo.4453 Posted: Sat Oct 13 19:27:14 1984 Date-Received: Sat, 13-Oct-84 19:27:14 EDT References: <1538@wateng.UUCP> Organization: U of Toronto Zoology Lines: 13 > [Compiler is optimizing out a wait-for-hardware-done loop.] > ... > 1. Was this legal code generation? > 2. Note that this compiler did "simple" optimizations as part of the code > generation. Is this legal? As to whether it's legal by K&R, the only answer is "mumble". This thorny issue was never addressed in the old days. The draft ANSI standard has a "volatile" declaration that you can use to tell the compiler "don't get tricky with this variable, it may change underfoot". -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry