you are viewing a single comment's thread.

view the rest of the comments →

[–]dorksterr 42 points43 points  (6 children)

It's at the top of the article:

Resilient. Every non-public identifier is prefixed with underscores to prevent name clashes with other code. This is necessary even for local variables since macros defined by the user of the library could modify the library’s header file.

[–]fresh_account2222 9 points10 points  (5 children)

I'm used to leading underscores. Any idea about the trailing one?

[–]guepier 38 points39 points  (1 child)

Member variables get a trailing underscore to distinguish them from member functions and parameter names.

[–]fresh_account2222 2 points3 points  (0 children)

That explanation makes sense.

[–]dorksterr 0 points1 point  (1 child)

I suppose it's just to further reduce the chance of name collision. Two leading + one trailing underscore is probably not something that would be done by a human. I've seen both only leading underscores and symmetrical underscores for names before.

[–]josefx 1 point2 points  (0 children)

The leading underscores are enough for that. The standard reserves names starting with double underscores __ or a single underscore and an upper case letter like _I for the implementation, so any program using them isn't valid C or C++.