MESSAGE
DATE | 2011-06-05 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Re: Anonymous namespace
|
-- forwarded message -- Path: reader1.panix.com!panix!not-for-mail From: ruben safir Newsgroups: comp.lang.c++ Subject: Re: Anonymous namespace Date: Thu, 02 Jun 2011 22:40:37 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Lines: 33 Message-ID: References: NNTP-Posting-Host: www2.mrbrklyn.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1307068838 9273 96.57.23.82 (3 Jun 2011 02:40:38 GMT) X-Complaints-To: abuse-at-panix.com NNTP-Posting-Date: Fri, 3 Jun 2011 02:40:38 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 In-Reply-To: Xref: panix comp.lang.c++:1085952
On 06/02/2011 10:07 PM, Stefan Ram wrote: > ruben safir writes: >> what is the anonymous name space and how is it accessed? > > When an unnamed namespace is defined as in > (»...« denotes the contents, not to be read literally) > > namespace { ... } > > , this is the same as > > namespace unique {} using namespace unique; namespace unique > { ... } > > , where »unique« is a unique (think: »compiler generated, > secret«) identifier used only for this namespace. >
Can the object in the namespace be accessed in main with ::
namespace{ int i; }
int main(int argc, char * argv[] ){ ::i = 20; std::cout << i << std::endl;
}
What is the point of the anonymous namespace.
Ruben -- end of forwarded message --
|
|