|
|
|
|
|
by kazinator
1301 days ago
|
|
Requiring C11 is itself a portability issue. I can easily whip up CAS for all platforms I care about, plus a few more for bonus, using nothing but C99 or C90 (and have actually done it before). Possibly, without even using any language extensions, unless I want the operations inlined. |
|
I'd be surprised if the former were possible. From a quick web search, C doesn't even give you the guarantees necessary for Peterson's Algorithm, [0][1] and volatile doesn't help. [2][3]
[0] https://codereview.stackexchange.com/a/124683
[1] https://stackoverflow.com/questions/35527557/errors-with-pet...
[2] https://web.archive.org/web/20160525000152/https://software....
[3] https://old.reddit.com/r/programming/comments/d457c/volatile...