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..



On Sat, 02 Dec 2006 16:28:10 -0500
David Kramer <david at thekramers.net> wrote:

> 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.
Again, I defer to the C standard:
"All identifiers that begin with an underscore and either an upper case
letter or another underscore are always reserved for any use."

"All identifiers that begin with an underscore are always reserved for
use as identifiers with file scope in both the ordinary identifier and
tag name spaces. "
4.1.2.1

In essence, public funtions and data in run-time libraries normally use
double underscores, for example in libc:
00003b50 T __malloc
00003b50 T malloc

You'll also see that the malloc symbol is set up as a weak symbol. This
allows the application programmer to write a private malloc and
override the system malloc. 


-- 
Jerry Feldman <gaf at blu.org>
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9



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