Hans-Kristian Arntzen post@arntzen-software.no wrote:
#if HAVE_SYNC_ADD_AND_FETCH # define atomic_add_fetch(ptr, val) __sync_add_and_fetch(ptr, val) -#else -# error "atomic_add_fetch() not implemented for this platform" +#elif defined(_MSC_VER) +/* InterlockedAdd returns value after increment, like add_and_fetch. */ +# define atomic_add_fetch(ptr, val) InterlockedAdd(ptr, val) #endif /* HAVE_SYNC_ADD_AND_FETCH */
Probably it would be better to still have the #error case.