Thread: How are atomics done in C99 (portably)?

  1. #1
    Registered User
    Join Date
    Sep 2019
    Posts
    5

    How are atomics done in C99 (portably)?

    I'm trying to not use extensions, whenever possible.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If it were that easy to do portably, the standards committee wouldn't have bothered with the whole atomics thing to begin with.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Sep 2019
    Posts
    5
    Quote Originally Posted by Salem View Post
    If it were that easy to do portably, the standards committee wouldn't have bothered with the whole atomics thing to begin with.
    To be clear, I wasn't excluding libraries from my question. I'm fine with a library that performs arch-specific things, as long as it supports more than just x86.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    How about adding yet more clarity, by saying
    - what processors you care about (more than just x86 doesn't say anything)
    - what compilers you care about
    - what operating systems you care about
    - what range of atomics you care about
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. listing files in directories portably
    By ab384 in forum C Programming
    Replies: 2
    Last Post: 11-03-2004, 10:50 AM

Tags for this Thread