bug-glibc
[Top][All Lists]
Advanced

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

Namespace cleanliness and levels of indirection


From: Igor Khavkine
Subject: Namespace cleanliness and levels of indirection
Date: Sat, 23 Jun 2001 16:15:55 -0400
User-agent: Mutt/1.3.18i

Hi, I'm working on an implementation of pthreads for GNU/Hurd
which will hopefully be integrated into the GLIBC later on.
The original unfinished code that I picked up was written
by Mark Kettenis. When he created the code he already adopted
some conventions like the directory hierarchy (it mirrors that
of GLIBC) and internal function and variable naming.

I hope someone can clarify for me the naming conventions used by the
GLIBC code.

As I understand most internal functions and variables are prefixed with
two underscores __. That is understandable for symbols lying in the
global namespace. But why would it be necessary to prefix structure
members and variables names of local scope with __  as well?

Also I've noticed several ways of converting internal symbols into
user visible ones. (a) Using a simple #define foo __foo, (b) using
a level of indirection int foo() { return __foo(); }, (c) using
weak_alias (__foo, foo). Which one of these is the preferred one?
If more then one is commonly used, then what are the circumstances?

Right now the code I have uses a mix of the above conventions. I would
like to adopt a single one if possible. That would both simplify
the code and render it more uniform.

Thanks in advance.

Igor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]