Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!216.196.98.142.MISMATCH!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 05 Jul 2012 13:59:48 -0500 Message-ID: <4FF5E425.56B@mindspring.com> Date: Thu, 05 Jul 2012 14:59:49 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Clarification on the applicability of compile-time optimization to a struct variable which encompasses a mixture of fields declared as volatile and non-volatile individually References: <94eafd27-6aba-4a17-9403-d42912312e6c@googlegroups.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 31 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.219.250 X-Trace: sv3-nWrFSlt7dsxNpSTpY/409sbIkwe7YIVflAbwnCaD+YPfkxDlNewQjGf+V8MTG6Mxtmv+tyO+fEQ0r2N!KdfdfX0hvWJ8D9KVM/PGlcGsVDmwYUrAYdducw/l7dKREyKpg9424oO5FKQrWbM9D4p22zdrAkwv!+IPnG9X85w== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1797 Xref: csiph.com comp.lang.c:23090 Myth__Buster wrote: > > #include > > struct InterruptData > { > int numberOfInterrupts; > volatile int timer; > int numberOfTimesInterruptsMasked; > } InterruptMonitor; > > /* > * Interrupt handler code. > */ > > int main(void) > { > InterruptMonitor = InterruptMonitor; > InterruptMonitor = InterruptMonitor; > - Should this be a candidate for compile-time optimization > in spite of having a field qualified as volatile? I don't think so. Merely accessing a volatile object, is considered to be a side effect. -- pete