Newsgroups: comp.os.msdos.djgpp From: "William A. Barath" Subject: Re: Register variables with -O2 In-Reply-To: Content-Type: TEXT/PLAIN; charset=US-ASCII Message-ID: Sender: news AT freenet DOT victoria DOT bc DOT ca (News Manager) Organization: Victoria Telecommunity Network References: Mime-Version: 1.0 Date: Sat, 10 Jan 1998 02:26:42 GMT Lines: 28 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 8 Jan 1998, Geza Herman wrote: |How can I tell the compiler which variables use as register and which |not when I use the option -O2? I believe the correct answer to this question is, "you don't really want to." DJGPP does a much better job of compiling if you don't use explicit register variables. Unless you are adding optimal hand-coded assembly. If you are adding Assembly, then you know how to specify register variables. If your question is more along the lines of "How can I tell gcc to not registerize a variable for me" then I'd say "don't use the -O1 or -O2 options" If your question was targeting the concept of making sure a variable will always be synchronized from its register to its storage, then the answer was "use the -fforce-mem" flag, which will force gcc to always write out registerized variables after evaluation. Otherwise, gcc will determine for you the best use of the registers to eliminate reloads and re-evaluations. Trust it. Wil Barath, aka WseM : "I feel as though I see my pen to write" Author of VPM, EDITPLN, and other VGA Planets support programs Visit my homepage! -------------> http://victoria.tc.ca/~wi534