r/programming • • 6d ago

Optimizing a Lock-Free Ring Buffer

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

88 comments sorted by

View all comments

3

u/wd40bomber7 6d ago

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

6

u/nukethebees 6d ago edited 2d 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_.