In C is "i+=1;" atomic?

Crazy Chenz picture Crazy Chenz · Nov 24, 2009 · Viewed 11.6k times · Source

In C, is i+=1; atomic?

Answer

Steve Jessop picture Steve Jessop · Nov 24, 2009

The C standard does not define whether it is atomic or not.

In practice, you never write code which fails if a given operation is atomic, but you might well write code which fails if it isn't. So assume it isn't.