Sunday, January 04, 2009

[Cpp-Programming] Re: why underscore character "_" is used a lot in the CPP standard library

On Sun, Jan 4, 2009 at 10:53 PM, SeaN <guo.xiaoyong@gmail.com> wrote:

A lot of member functions and variables have "_" as the first
character of their names.
Why?

Historical reasons.  There are no private variables in C, so to separate functions and variables that should be used from outside a library from those that shouldn't, they used underscores for things internal to the library.
The practice never went away because it's convenient to know when writing/looking at code which variables are private and which aren't.  A good IDE with intelligent highlighting and intellisense-like capabilities will tell you this anyways, but a surprising number of programmers refuse to give up their outdated editors.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

<< Home