By: Gabriele Svelto (gabriele.svelto.delete@this.gmail.com), December 5, 2014 12:45 pm
Room: Moderated Discussions
Eric Bron (eric.bron.delete@this.zvisuel.privatefortest.com) on December 5, 2014 10:32 am wrote:
> even good old C++ is quite expressive and safe enough
Across multiple platforms using atomics wasn't pretty as you had to use whatever came with the compiler which ranged from volatile (!) or Interlocked* primitives on Microsoft to GCC __builtin_*() functions and even asm() when those weren't enough. Naturally one would hide that behind a decent abstraction anyway (e.g. we have an Atomics template in Mozilla's MFBT framework that hides all of the compiler/platform kludges from the user) but even then one had to maintain that kind of stuff and it wasn't pretty. Plus it also hid your intent from the compiler reducing the optimization possibilities. Having native atomics in C/C++ helps with that too.
> even good old C++ is quite expressive and safe enough
Across multiple platforms using atomics wasn't pretty as you had to use whatever came with the compiler which ranged from volatile (!) or Interlocked* primitives on Microsoft to GCC __builtin_*() functions and even asm() when those weren't enough. Naturally one would hide that behind a decent abstraction anyway (e.g. we have an Atomics template in Mozilla's MFBT framework that hides all of the compiler/platform kludges from the user) but even then one had to maintain that kind of stuff and it wasn't pretty. Plus it also hid your intent from the compiler reducing the optimization possibilities. Having native atomics in C/C++ helps with that too.