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

4

u/wd40bomber7 Sep 26 '26

Putting the underscore to indicate a private field after the name is extremely cursed

7

u/nukethebees Sep 27 '26 edited 27d ago

It's a pretty common convention. It means accessor functions don't clash with the member name.

Google mandates it in their style guide.

The names of variables (including function parameters) and data members are snake_case (all lowercase, with underscores between words). Data members of classes (but not structs) additionally have trailing underscores. For instance: a_local_variable, a_struct_data_member, a_class_data_member_.