Date: Sun, 16 Apr 2000 10:39:34 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: "Alexei A. Frounze" cc: djgpp AT delorie DOT com Subject: Re: THE -O2 PROBLEM - PART II In-Reply-To: <38F8BB6D.22C2064@mtu-net.ru> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sat, 15 Apr 2000, Alexei A. Frounze wrote: > the only solution I see is something like this: > > ----------8<---------- > int keymap (int key) { > return KeyMap[key]; > } > > int main() { > do_something(); > if (keymap(sTab)) { > do_something(); > while (keymap(sTab)) {}; > } > do_something(); > } > ----------8<---------- Nate suggested to declare KeyMap[] volatile. That's the Right Way of solving these problems: variables that change their values behind compiler's back should be declared as such, and then the compiler will do what you want. Did you try to use `volatile'? Did it work? If not, why not?