29.5.1 in N2960 declares the following member functions for std::atomic_itype:
integral operator+=(integral) volatile; integral operator-=(integral) volatile; integral operator&=(integral) volatile; integral operator|=(integral) volatile; integral operator^=(integral) volatile;
Some of these are also declared for std::atomic_address and std::atomic<T*>. But I can't find any description of their semantics including, rather critically, whether they are atomic operations. Am I overlooking semantic descriptions somewhere?
Thanks,
Scott
-- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-...@netlab.cs.rpi.edu] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Scott Meyers wrote: > 29.5.1 in N2960 declares the following member functions for > std::atomic_itype:
> integral operator+=(integral) volatile; > integral operator-=(integral) volatile; > integral operator&=(integral) volatile; > integral operator|=(integral) volatile; > integral operator^=(integral) volatile;
> Some of these are also declared for std::atomic_address and > std::atomic<T*>. > But I can't find any description of their semantics including, rather > critically, whether they are atomic operations. Am I overlooking semantic > descriptions somewhere?
[ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-...@netlab.cs.rpi.edu] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Scott Meyers <use...@aristeia.com> writes: > 29.5.1 in N2960 declares the following member functions for > std::atomic_itype:
> integral operator+=(integral) volatile; > integral operator-=(integral) volatile; > integral operator&=(integral) volatile; > integral operator|=(integral) volatile; > integral operator^=(integral) volatile;
> Some of these are also declared for std::atomic_address and std::atomic<T*>. > But I can't find any description of their semantics including, rather > critically, whether they are atomic operations. Am I overlooking semantic > descriptions somewhere?
See 29.6p6.
C A::operator op=(M operand) volatile; E ?ects: fetch_key(operand) Returns: fetch_key(operand) op operand
where "key" and "op" are given in table 137. This says that a+=b is equivalent to a.fetch_add(b)+b, and so forth for the other operators.
[ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-...@netlab.cs.rpi.edu] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
> C A::operator op=(M operand) volatile; > Effects: fetch_key(operand) > Returns: fetch_key(operand) op operand
> where "key" and "op" are given in table 137. This says that a+=b > is equivalent to a.fetch_add(b)+b, and so forth for the other operators.
Okay, I see it now. Silly me, searching for "|=" in an attempt to find a description of semantics for operator|=.
For the record, my copy of N2960 has this information in paragraphs 22ff, not paragraph 6.
Scott
-- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-...@netlab.cs.rpi.edu] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-...@netlab.cs.rpi.edu<std-c%2B...@netlab.cs.rpi.edu> ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]