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: Sat, 4 Jun 2011 04:56:47 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 26 Message-ID: References: <94rjavFbjiU7-at-mid.individual.net> <94tnpvFivcU1-at-mid.individual.net> NNTP-Posting-Host: www2.mrbrklyn.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1307163407 20952 96.57.23.82 (4 Jun 2011 04:56:47 GMT) X-Complaints-To: abuse-at-panix.com NNTP-Posting-Date: Sat, 4 Jun 2011 04:56:47 +0000 (UTC) X-Blackjet: Blackjet is a Yankee Fan X-DRMisTHEFT: Use GNU Linux today X-From: A Dark Cloud X-LOCATION: Brooklyn NY - Forget abou' it! X-NYLXS: Really - yah think computers are supposed to be broken? User-Agent: Pan/0.133 (House of Butterflies) Xref: panix comp.lang.c++:1086002
On Sat, 04 Jun 2011 15:40:46 +1200, Ian Collins wrote:
>> so the annonymous name space must be in the same file as main? > > No, it can be an any compilation unit, that's one of the reasons for its > existence. > > I could have write "namespace { int n; }" in a dozen source files (or a > header they include) and there would be a dozen unique instances of n.
Sorry for being thick about this, but such stuff is not covered in normal C++ text books. It seems you have to learn it by word of mouth or maybe I need yet more books.
A single computational unit is the files that are used to create any single object file? That would be basically anything that would be #include (ed) in a source file?
Now what makes that interesting is that when I was studying templates, the declarations and definitions needed to be inside the same file. How is that related (or the reason why it is not related)to the concept of a transitional unit? And how does this affect the linking of shared libraries?
Ruben -- end of forwarded message --
|
|