www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/15/16:45:36

Xref: news2.mv.net comp.os.msdos.djgpp:5008
Newsgroups: comp.os.msdos.djgpp
From: aml AT world DOT std DOT com (Andrew M. Langmead)
Subject: Re: How to tell djgpp NOT to optimate a line of code
Message-ID: <Dszo6x.D9M@world.std.com>
Organization: The World @ Software Tool & Die
References: <Pine DOT VUL DOT 3 DOT 91 DOT 960613123358 DOT 3422E-100000 AT zeus DOT adv-boeblingen DOT de>
Date: Fri, 14 Jun 1996 12:04:09 GMT
Lines: 22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Lennart Steinke <steinke AT zeus DOT adv-boeblingen DOT de> writes:

>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)?

Why don't you declare the variable g as a volatile int?
-- 
Andrew Langmead

- Raw text -


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