Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Alexander Terekhov Newsgroups: comp.programming.threads Subject: Re: forcing the compiler to reload from memory with c++0x Date: Wed, 02 Feb 2011 12:13:32 +0100 Organization: A noiseless patient Spider Lines: 38 Message-ID: <4D493C5C.83CA38C@web.de> References: <4d3cee42$0$1209$426a74cc@news.free.fr> <1d21ad0a-db55-460e-aeb6-66f6d19369ea@i13g2000yqe.googlegroups.com> <4d3e2e3f$0$21517$426a34cc@news.free.fr> <4D40A4C7.16E6F9AE@web.de> <69d82db7-34be-4de7-86c4-2f39cc1e6df3@m13g2000yqb.googlegroups.com> <4d4221e9$0$17247$426a74cc@news.free.fr> <947b33d5-2509-4f0c-9256-a7c3de35578e@24g2000yqa.googlegroups.com> <87mxmlxxry.fsf@justsoftwaresolutions.co.uk> <87oc6yxdcw.fsf@justsoftwaresolutions.co.uk> <87sjw8w4b5.fsf@justsoftwaresolutions.co.uk> <4D480800.1C5132D7@web.de> <87k4hjx3ph.fsf@justsoftwaresolutions.co.uk> <4D482797.CBE41A86@web.de> <90c4d6f1-c539-4fdc-9b20-2cc6bc92dbe4@z20g2000yqe.googlegroups.com> Reply-To: terekhov@web.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="rjEYssPBnvQCB352RfJgNw"; logging-data="8286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YEvdtqGgSyPqn92rZ4WuUuHIJ4TGrf8s=" X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en Cancel-Lock: sha1:8osMAJuEJ9Q62M7EC06SVlqzEjI= Xref: csiph.com comp.programming.threads:1814 Dmitriy Vyukov wrote: > > On 1 фев, 18:32, Alexander Terekhov wrote: > > Anthony Williams wrote: > > > > > Alexander Terekhov writes: > > > > > > Anthony Williams wrote: > > > > [...] > > > >> You can of course make your atomic variables volatile too, and then they > > > >> DO become observable behaviour. > > > > > > Observable as in what? Memory mapped I/O variables and signal handlers > > > > aside, you can't mean debuggers and/or asm listings. The following > > > > programs > > > > > The C++ Standard defines "observable behaviour" to be the set of > > > accesses to volatile variables and I/O performed by the program. > > > > > The only requirement on a compiled program is that it produce the same > > > set of observable behaviour as that required by the abstract machine, > > > which includes accesses to volatile variables. > > > > > How you are supposed to observe the accesses to volatile variables is > > > not specified. > > > > Yet you call it observable? > > Does it differ from printf() in essence? If a program redirects printf() output to dev/null and compiler is able to detect such redirection then printf() can be optimized away just like the use of volatile when it has nothing to do with MMIO, signal handlers, setjmp/longjmp. regards, alexander.