Hello guys,

Do ++/-- are atomic operations in c++?

Thanks

Recommended Answers

All 2 Replies

I doubt there is such a natural atomic operation in C++. If you use a library to force anything to be atomic, then it should. I would say no in this case.

Yes, when applied to integers and pointers they are always atomic, but the overloaded ++/-- are not, since they are translated by the compiler into instructions that are more than one.

Read this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.