Xref: news2.mv.net comp.os.msdos.djgpp:5012 From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: How to tell djgpp NOT to optimate a line of code Date: Fri, 14 Jun 1996 23:15:03 -0700 Organization: Alcyone Systems Lines: 22 Message-ID: <31C254E7.65FBF938@alcyone.com> References: NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Lennart Steinke wrote: > I wrote a ISR which hook into the timer interrupt and updates > a global variable. ... > ist there a possibilty to tell gcc not to touch the code > (similar to the __volatile__ keyword)? Yes. It's called the volatile keyword. :-) Declare the global variable as being `volatile'. Then the compiler won't optimize the comparison away. The `volatile' keyword is ANSI C, so you don't have to worry about it being nonportable. -- Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max AT alcyone DOT com San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_