public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: "Artem Khodush" <artem@duma.gov.ru>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org
Subject: Re: c++/3084: anonymous namespace linking
Date: Fri, 08 Jun 2001 06:26:00 -0000	[thread overview]
Message-ID: <20010608132600.27348.qmail@sourceware.cygnus.com> (raw)

The following reply was made to PR c++/3084; it has been noted by GNATS.

From: "Artem Khodush" <artem@duma.gov.ru>
To: <conversy@emn.fr>
Cc: <gcc-gnats@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>
Subject: Re: c++/3084: anonymous namespace linking
Date: Fri, 8 Jun 2001 16:48:55 +0400

 > anonymous namespace functions cannot be linked
 > to global call to these functions.
 > 
 > There is an error when linking an object file with
 > the code of a function declared inside a unnamed
 > "namespace {}".
 > 
 > In the .o that includes the function code, the name
 > is the form *__GLOBAL__* where in the .o that refers
 > to the function code, the name is different.
 > 
 
 This is not a bug, this behavior is requred by the c++ 
 standard, and is the very reason of existence of
 unnamed namespaces.
  
 7.3.1.1 - Unnamed namespaces [namespace.unnamed]
 -1- An unnamed-namespace-definition behaves as if it were 
 replaced by 
 
 namespace 'unique' { /* empty body */ }
 using namespace 'unique';
 namespace 'unique' { namespace-body }
 
 where all occurrences of 'unique' in a translation unit are 
 replaced by the same identifier and this identifier differs 
 from all other identifiers in the entire program.* 
 
 [Footnote: Although entities in an unnamed namespace 
 might have external linkage, they are effectively qualified 
 by a name unique to their translation unit and therefore 
 can never be seen from any other translation unit. 
 --- end footnote]
 
 
 
 


             reply	other threads:[~2001-06-08  6:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-08  6:26 Artem Khodush [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-07-11 10:44 mmitchel
2001-06-08  4:56 conversy

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=20010608132600.27348.qmail@sourceware.cygnus.com \
    --to=artem@duma.gov.ru \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).