
please wait
volatile access does not establish inter-thread synchronization. ... Standard volatile semantics are not applicable to multithreaded programming https://en.cppreference.com/w/cpp/atomic/memory_order#Relationship_with_volatile |
|
|
frek wrote: |
---|
3) > assert( result = N * (N+1) / 2 ) ; // sanity check What does this assertion do? I mean as far as I'm concerned, assert has been used to check an equivalent, but there you apply an *assignment*. Then likely you check that if it's done correctly or not. Right!? |
by "typically used when they are shared between normal program code" do you mean when a variable is send or returned from a function to another, similar to our code? |
JLBorges wrote: |
---|
typically used when they are shared between normal program code and: [a list of other things] |
volatile objects are typically used when they are shared between normal program code and: 1. Code in a signal handler 2. An interrupt service routine 3. Memory-mapped i/o devices etc. |
|
|
|
|