From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: bert hubert <ahu@ds9a.nl>,
Jan Engelhardt <jengelh@linux01.gwdg.de>,
krishna <krishna.c@globaledgesoft.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: what does __foo means.
Date: Tue, 7 Dec 2004 16:29:19 +0100 [thread overview]
Message-ID: <20041207152919.GA28166@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20041207131122.GA25796@outpost.ds9a.nl>
On Tue, 7 December 2004 14:11:22 +0100, bert hubert wrote:
>
> Nonsense. The _ is used to provide for a new namespace, __ for a second one.
> It is common to have a public function 'foo()' which does lots of error
> checking and has a stable api. foo() in turn calls _foo() to do the actual
> work, perhaps doing additional checking and verification.
>
> The _namespace is bound by certain rules, some of which apply to the kernel
> as well. The compiler is free to output symbols in the _Namespace, as well
> as in the __namespace.
>
> "To get specific, identifiers with two leading underscores are reserved for
> the compiler as well as identifiers beginning with a single underscore and
> using an upper case alphabetic character for the second. "
>
> The linux kernel breaks this by using __ for even more private things.
C99:
"All identifiers that begin with an underscore and either an uppercase
letter or another underscore are always reserved for any use."
That applies to normal userspace programs. It allows compiler, libc
and possibly the kernel to introduce new identifiers without breaking
existing programs. If programs break, it is their fault, they
shouldn't have used such identifiers.
The kernel is quite different. Basically, all identifiers belong to
the kernel, none to libc/gcc (with very few exceptions). So
developers are free to use that at their pleasure and most stick to
your description in the first paragraph.
Jörn
--
You cannot suppose that Moliere ever troubled himself to be original in the
matter of ideas. You cannot suppose that the stories he tells in his plays
have never been told before. They were culled, as you very well know.
-- Andre-Louis Moreau in Scarabouche
next prev parent reply other threads:[~2004-12-07 15:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-07 12:45 krishna
2004-12-07 12:54 ` Jan Engelhardt
2004-12-07 13:08 ` Josh Boyer
2004-12-07 13:11 ` bert hubert
2004-12-07 15:29 ` Jörn Engel [this message]
[not found] <fa.gd7ov5r.1n64a8t@ifi.uio.no>
2004-12-07 15:52 ` Bodo Eggert
2004-12-07 22:52 ` Kyle Moffett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041207152919.GA28166@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=ahu@ds9a.nl \
--cc=jengelh@linux01.gwdg.de \
--cc=krishna.c@globaledgesoft.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®