From 2856337229392813816 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,47ad86575b18887f X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 2001-07-17 18:10:03 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.42.224.136!diablo.netcom.net.uk!netcom.net.uk!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail From: "James Kuyper Jr." Newsgroups: comp.std.c++ Subject: Re: unnamed namespace quesion Date: Wed, 18 Jul 2001 01:09:01 GMT Organization: Not Enough Approved: Fergus Henderson , moderator of comp.std.c++ Message-ID: <3B54E127.E35402FF@wizard.net> References: X-Trace: mail2news.demon.co.uk 995418546 mail2news:21033 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-Accept-Language: en,es,de,ru MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 35 Xref: archiver1.google.com comp.std.c++:6585 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. > 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: > 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 ]