From 5519316166960072219 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,47ad86575b18887f X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2001-07-18 08:04:01 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail From: "Paul Mensonides" Newsgroups: comp.std.c++ Subject: Re: unnamed namespace quesion Date: Wed, 18 Jul 2001 15:03:05 GMT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: <65657.366621$p33.7394138@news1.sttls1.wa.home.com> References: <3B54E127.E35402FF@wizard.net> X-Trace: mail2news.demon.co.uk 995468617 mail2news:26952 mail2news mail2news.demon.co.uk X-Complaints-To: abuse@demon.net X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Date: Tue, 17 Jul 2001 19:00:34 PDT Lines: 66 Xref: archiver1.google.com comp.std.c++:6587 "James Kuyper Jr." wrote in message news:3B54E127.E35402FF@wizard.net... > Paul Mensonides wrote: > > > > Is it legal to define a function outside of an unnamed namespace? > > > > namespace { > > void f(); > > } > > > > void f() { > > return; > > } > > Yes. What you've done there is define f() in the global namespace. That is not what I mean. Is f(), in the above example, local to the translation unit, or is f() a declaration in a *different* scope than the one declared in the unnamed namespace? I want to *define* the function outside of the namespace nesting: // like this... namespace A { void f(); } void A::f() { return; } // but without the namespace name... namespace { void f(); } void f() { return; } > > If it isn't, it should be. Defining functions in a nested fashion is annoying, > > and it makes me (and possibly others) prefer 'static' functions: > > > > static void f() { > > return; > > } > > That use of static is officially deprecated, in favor of the following: I realize that. My point is that defining functions in a nested manner is annoying. Paul Mensonides > > namespace { > > void f() { > > return; > > } > > } --- [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.research.att.com/~austern/csc/faq.html ]