title: What is the difference between the __sync and __atomic intrinsics of gcc
body: <p>I'm writing a toy operating system (so I cannot use any library, including the standard one), compiled with gcc, and I want to use atomics for some of the synchronization code. After some search, I found that gcc has two sets of builtins for atomic operations, <a href="http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins" rel="nofollow">__sync_*</a> and <a href="http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html" rel="nofollow">__atomic_*</a>, but there is no information as to the difference between the two.</p>
  
  <p>What is the difference between these two besides the latter has a parameter for memory ordering? Is the <code>__sync_</code> version equivalent to <code>__atomic_</code> version with the sequential ordering? Is the <code>__sync_</code> version deprecated in favor of the <code>__atomic_</code> one?</p>