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


Groups > comp.lang.c++ > #67786

"volatile" on variables and current processors

From Vir Campestris <vir.campestris@invalid.invalid>
Newsgroups comp.lang.c++
Subject "volatile" on variables and current processors
Date 2019-08-19 21:56 +0100
Organization A noiseless patient Spider
Message-ID <qjf2ec$rph$4@dont-email.me> (permalink)

Show all headers | View raw


In the old days volatile on a variable meant putting it in memory, not 
holding it in a register. That was easy.

C++ is designed around multiple processors with non-coherent caches, and 
we have memory fences and such to keep things clean.

volatile is no longer adequate for such machines.

That's the theory - but the practice - I've bumped into a big lump of C 
code in our codebase being built by #include from a C++ program - so the 
compiler will be applying C++ rules. And it's got lots of use of 
volatile in the old way - don't cache this please, another thread may 
touch it.

Will this actually be a problem on current ARM processors?

I'm reasonably sure that none of the accesses are close enough that 
re-ordering would matter.

Andy

Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

"volatile" on variables and current processors Vir Campestris <vir.campestris@invalid.invalid> - 2019-08-19 21:56 +0100
  Re: "volatile" on variables and current processors red floyd <dont.bother@its.invalid> - 2019-08-19 15:20 -0700
    Re: "volatile" on variables and current processors red floyd <dont.bother@its.invalid> - 2019-08-19 15:21 -0700
      Re: "volatile" on variables and current processors "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-08-19 16:37 -0700
        Re: "volatile" on variables and current processors Vir Campestris <vir.campestris@invalid.invalid> - 2019-08-20 21:58 +0100
          Re: "volatile" on variables and current processors scott@slp53.sl.home (Scott Lurndal) - 2019-08-20 22:18 +0000
            Re: "volatile" on variables and current processors Vir Campestris <vir.campestris@invalid.invalid> - 2019-08-22 21:39 +0100
          Re: "volatile" on variables and current processors Paavo Helde <myfirstname@osa.pri.ee> - 2019-08-21 09:02 +0300
            Re: "volatile" on variables and current processors "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-08-20 23:10 -0700
          Re: "volatile" on variables and current processors David Brown <david.brown@hesbynett.no> - 2019-08-21 08:34 +0200
            Re: "volatile" on variables and current processors Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-08-21 20:39 +0100
              Re: "volatile" on variables and current processors Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-08-21 21:02 +0100
              Re: "volatile" on variables and current processors David Brown <david.brown@hesbynett.no> - 2019-08-22 13:30 +0200
        Re: "volatile" on variables and current processors Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-21 08:43 +0200
      Re: "volatile" on variables and current processors "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-08-20 02:22 +0200
        Re: "volatile" on variables and current processors David Brown <david.brown@hesbynett.no> - 2019-08-20 10:05 +0200
    Re: "volatile" on variables and current processors Keith Thompson <kst-u@mib.org> - 2019-08-19 17:08 -0700
  Re: "volatile" on variables and current processors Bonita Montero <Bonita.Montero@gmail.com> - 2019-08-20 06:08 +0200
  Re: "volatile" on variables and current processors David Brown <david.brown@hesbynett.no> - 2019-08-20 10:14 +0200
  Re: "volatile" on variables and current processors Juha Nieminen <nospam@thanks.invalid> - 2019-08-20 13:03 +0000
    Re: "volatile" on variables and current processors David Brown <david.brown@hesbynett.no> - 2019-08-20 16:18 +0200

csiph-web