www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/16/03:40:05

Xref: news2.mv.net comp.os.msdos.djgpp:5025
From: Tom Wheeley <tomw AT tsys DOT demon DOT co DOT uk>
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: <Pine DOT VUL DOT 3 DOT 91 DOT 960613123358 DOT 3422E-100000 AT zeus DOT adv-boeblingen DOT de>
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 <Pine DOT VUL DOT 3 DOT 91 DOT 960613123358 DOT 3422E-100000 AT zeus DOT adv-boeblingen DOT de>
           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 <g> ... 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.")

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019