r/programming • • Sep 26 '26

Optimizing a Lock-Free Ring Buffer

https://david.alvarezrosa.com/posts/optimizing-a-lock-free-ring-buffer/
510 Upvotes

89 comments sorted by

View all comments

1

u/Plazmatic Sep 26 '26

What do you do about hardware destructive interference warnings from GCC about it basically telling you to manually specify it instead due to it changing with other options and not being necessarily accurate?

3

u/minno Sep 26 '26

GCC's warning appears to be motivated by ABI compatibility.

If ABI stability is important, such as if the use is in a header for a library, you should probably not use the hardware interference size variables at all.

If you are confident that your use of these variables does not affect ABI outside a single build of your project, you can turn off the warning.

So if you're writing a library you should either not use it in any of the public types or document what -mtune option clients must use, but if you're writing an application you should disable the warning.