Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

leading underscores..



Stephen Adler wrote:
> Guys,
> 
> This is a programing question, so I hope you guys don't mind my posting
> to this mailing list.
> 
> I've run across an issue about using underscores in variable names. I've
> been writing software
> under linux for the past 15 years and I've gotten into the habit of
> using underscores in my
> variables names for priviate variables in a class. I tried to compile my
> code on Solaris
> 10 x86 using the gnu compiler and it threw errors because the compiler
> didn't like the
> leading underscore. Does anyone have any comments on this? If a leading
> underscore
> is not used to private variable and functions in classes, what the
> coding standard to indicate
> the variable belongs to the class your coding?

In many environments, leading underscores are used for the name of the
internal runtime functions that thou shalt not call directly, and this
is done to prevent name collisions (since it predates namespaces).  It's
not a good idea to use them in your own code, whether your particular
environment supports them or not.



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org