Xref: news2.mv.net comp.os.msdos.djgpp:5025 From: Tom Wheeley Newsgroups: comp.os.msdos.djgpp Subject: Re: How to tell djgpp NOT to optimate a line of code Date: Thu, 13 Jun 96 19:36:37 GMT Organization: City Zen FM Lines: 34 Message-ID: <834694597snz@tsys.demon.co.uk> References: Reply-To: tomw AT tsys DOT demon DOT co DOT uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article steinke AT zeus DOT adv-boeblingen DOT de "Lennart Steinke" writes: > Hi! > > I wrote a ISR which hook into the timer interrupt and updates > a global variable. > > say this var is ... my code looks something like > > int b; > > b=g; > while (b==g); > > > this loop is always optimazed to > while(1); > > ist there a possibilty to tell gcc not to touch the code > (similar to the __volatile__ keyword)? Well, I'm not too well versed in the use of interrupts etc, but a possible if kludgy way to solve your problem is to put your cide in a function in a separate source file, which you compile to a .o with no optimisation. ..splitbung -- * TQ 1.0 * The 'Just So Quotes'. "MOM, CAN I SET FIRE TO MY BED MATTRESS?" "No, Calvin." "CAN I RIDE MY TRICYCLE ON THE ROOF?" "No, Calvin." "Then can I have a cookie?" "No, Calvin." ("She's on to me.")