Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #1814

Re: forcing the compiler to reload from memory with c++0x

From Alexander Terekhov <terekhov@web.de>
Newsgroups comp.programming.threads
Subject Re: forcing the compiler to reload from memory with c++0x
Date 2011-02-02 12:13 +0100
Organization A noiseless patient Spider
Message-ID <4D493C5C.83CA38C@web.de> (permalink)
References (11 earlier) <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>

Show all headers | View raw


Dmitriy Vyukov wrote:
> 
> On 1 фев, 18:32, Alexander Terekhov <terek...@web.de> wrote:
> > Anthony Williams wrote:
> >
> > > Alexander Terekhov <terek...@web.de> 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? <chuckles>
> 
> 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.

Back to comp.programming.threads | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: forcing the compiler to reload from memory with c++0x Alexander Terekhov <terekhov@web.de> - 2011-02-01 14:17 +0100
  Re: forcing the compiler to reload from memory with c++0x Alexander Terekhov <terekhov@web.de> - 2011-02-02 14:45 +0100
    Re: forcing the compiler to reload from memory with c++0x Dmitriy Vyukov <dvyukov@gmail.com> - 2011-02-02 07:02 -0800
      Re: forcing the compiler to reload from memory with c++0x Alexander Terekhov <terekhov@web.de> - 2011-02-02 16:33 +0100
  Re: forcing the compiler to reload from memory with c++0x Alexander Terekhov <terekhov@web.de> - 2011-02-01 16:32 +0100
    Re: forcing the compiler to reload from memory with c++0x Alexander Terekhov <terekhov@web.de> - 2011-02-02 12:13 +0100
      Re: forcing the compiler to reload from memory with c++0x Dmitriy Vyukov <dvyukov@gmail.com> - 2011-02-02 04:54 -0800
    Re: forcing the compiler to reload from memory with c++0x Dmitriy Vyukov <dvyukov@gmail.com> - 2011-02-01 21:02 -0800
    Re: forcing the compiler to reload from memory with c++0x Joshua Maurice <joshuamaurice@gmail.com> - 2011-02-01 15:19 -0800
  Re: forcing the compiler to reload from memory with c++0x Anthony Williams <anthony.ajw@gmail.com> - 2011-02-01 13:51 +0000

csiph-web