MESSAGE
DATE | 2011-06-05 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Re: Anonymous namespace
|
-- forwarded message -- Path: reader1.panix.com!panix!panix.com!mrbrklyn From: Ruben Safir Newsgroups: comp.lang.c++ Subject: Re: Anonymous namespace Date: Sat, 4 Jun 2011 02:44:29 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 28 Message-ID: References: <03464db0-e118-463c-9834-171dab457e42-at-h9g2000yqk.googlegroups.com> NNTP-Posting-Host: panix2.panix.com X-Trace: reader1.panix.com 1307155469 11543 166.84.1.2 (4 Jun 2011 02:44:29 GMT) X-Complaints-To: abuse-at-panix.com NNTP-Posting-Date: Sat, 4 Jun 2011 02:44:29 +0000 (UTC) User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (NetBSD/5.1 (i386)) Xref: panix comp.lang.c++:1085997
Victor Bazarov wrote: > On 6/3/2011 4:08 AM, gwowen wrote: >> On Jun 3, 3:54 am, r...-at-zedat.fu-berlin.de (Stefan Ram) wrote: >>>> What is the point of the anonymous namespace. >>> >>> Names can be hidden from the linker (from other translation >>> units), even if they should have external linkage. >> >> Can someone give the benefits of external-but-unlinkable anon- >> namespace variables (or functions) against old-school internal linkage >> file-scope "static" variables and functions. > > The Standard prohibits the use of names with no linkage or names with > internal linkage as template arguments.
Thanks Victor, but I have limited understanding of internal linkage, and can't see how there can be no linkage to a name. Can you expand on that aspect of the conversation?
Ruben
> Only objects with external > linkage are allowed. Hence you can't use a function declared 'static' > or a local type as a predicate in 'std::sort', for instance, or as the > functor in 'std::for_each', and so on. > > V -- end of forwarded message --
|
|