MESSAGE
DATE | 2011-06-05 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Re: Anonymous namespace
|
From owner-hangout-outgoing-at-mrbrklyn.com Sun Jun 5 00:27:50 2011 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: by www2.mrbrklyn.com (Postfix) id E2666100BD1; Sun, 5 Jun 2011 00:27:48 -0400 (EDT) Delivered-To: hangout-outgoing-at-www2.mrbrklyn.com Received: by www2.mrbrklyn.com (Postfix, from userid 28) id 25F4A100BCD; Sun, 5 Jun 2011 00:27:47 -0400 (EDT) Delivered-To: hangout-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by www2.mrbrklyn.com (Postfix) with ESMTP id CB215100B98 for ; Sun, 5 Jun 2011 00:27:24 -0400 (EDT) Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 1A18932F0E for ; Sun, 5 Jun 2011 00:27:38 -0400 (EDT) Received: by panix2.panix.com (Postfix, from userid 20529) id 097A233C69; Sun, 5 Jun 2011 00:27:38 -0400 (EDT) From: Ruben Safir To: hangout-at-nylxs.com Subject: [NYLXS - HANGOUT] (fwd) Re: Anonymous namespace User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (NetBSD/5.1 (i386)) Message-Id: <20110605042738.097A233C69-at-panix2.panix.com> Date: Sun, 5 Jun 2011 00:27:37 -0400 (EDT) Sender: owner-hangout-at-mrbrklyn.com Precedence: bulk Reply-To: hangout-at-mrbrklyn.com
-- forwarded message -- Path: reader1.panix.com!panix!bloom-beacon.mit.edu!micro-heart-of-gold.mit.edu!nntp.club.cc.cmu.edu!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Victor Bazarov Newsgroups: comp.lang.c++ Subject: Re: Anonymous namespace Date: Fri, 03 Jun 2011 09:44:29 -0400 Organization: A noiseless patient Spider Lines: 20 Message-ID: References: <03464db0-e118-463c-9834-171dab457e42-at-h9g2000yqk.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 3 Jun 2011 13:44:30 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="mfoyPVXLF0MtM1ZkAsRgyQ"; logging-data="22668"; mail-complaints-to="abuse-at-eternal-september.org"; posting-account="U2FsdGVkX1/ld1vdKrwNO8VXsc0DWoyN1pYknQk3LVw=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: <03464db0-e118-463c-9834-171dab457e42-at-h9g2000yqk.googlegroups.com> Cancel-Lock: sha1:1tJdgbnJLXLDLsPO8FFaLAFSWmo= Xref: panix comp.lang.c++:1085973
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. 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 -- I do not respond to top-posted replies, please don't ask -- end of forwarded message --
|
|