Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #7185
| From | Ruben Safir <ruben@mrbrklyn.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Anonymous namespace |
| Date | 2011-06-27 16:34 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <iuabfe$iqo$1@reader1.panix.com> (permalink) |
| References | (3 earlier) <slrniv1bef.gtj.grahn+nntp@frailea.sa.invalid> <iss5it$fjr$2@reader1.panix.com> <slrniv4ogh.gtj.grahn+nntp@frailea.sa.invalid> <it45ki$ioc$7@reader1.panix.com> <slrnivbgoj.gtj.grahn+nntp@frailea.sa.invalid> |
On Mon, 13 Jun 2011 07:58:12 +0000, Jorgen Grahn wrote:
> On Mon, 2011-06-13, ruben safir wrote:
>> On Fri, 10 Jun 2011 18:27:29 +0000, Jorgen Grahn wrote:
>>
>>> On Fri, 2011-06-10, Ruben Safir wrote:
>>>> On Thu, 09 Jun 2011 11:26:08 +0000, Jorgen Grahn wrote:
>>>>
>>>>
>>>>>>> namespace unique {} using namespace unique; namespace unique { ...
>>>>>>> }
>>>>>>
>>>>>> ugg - back to the namespace syntax chapter...
>>>>>
>>>>> If you *do* have a book,
>>>>
>>>>
>>>> Jorgen, do you think I have any C++ references and do you think I
>>>> read them.
>>>
>>> If you had mentioned that you've read book X but still don't
>>> understand anonymous namespace because of Y, then I wouldn't have
>>> complained.
>>>
>>>
>> I'm partly sympathetic to that point. Your obviously not sitting in my
>> chair and you don't really know what I have and haven't read. But I'd
>> think that after all those previous posts, you'd have the gist that I'm
>> pouring over several texts.
>
> No, I had missed that. I knew I had read other postings by you, but
> didn't remember what they were about.
>
> ...
>> Trying to solve the problem of namespace polution by adding a 100,000
>> extra keystroke, to me is pointless...but that is another issue. I
>> have to deal with what C++ is, not what I want it to be.
>
> I think of namespaces (user-defined, non-anonymous) this way:
>
> I want the freedom to name things in a straightforward way without
> risking clashes with other people's stuff. I don't want to call some
> sorting function reorder() just because the standard library used up
> the name sort(). And I want the same freedom from conflicts /between/
> subsystems of my own program.
>
> So I invent the convention of prefixing everything: like my_sort(),
> foo_subsystem_sort(), ...
>
> Namespaces provide a standard way of doing that (my::sort()), and
> since it's part of the language it can be smart and not demand the
> prefix in contexts where it's /obvious/ which one I mean. And it lets
> me manually specify things like "in this context I mean my::sort()".
>
> So, compared to the manual alternative, you /save/ typing. /If/ you
> want to solve the naming problem, that is.
>
> That's not the only way to think of it, but I find it helpful.
>
>> (at least it is not tcl)
>
> Damning with faint praise, are we? ;-)
>
> /Jorgen
So there is one thing I'm still not understanding. If something is
declared in a anonymous namespace, how is it accessed in main?
Ruben
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Anonymous namespace ruben safir <ruben@mrbrklyn.com> - 2011-06-02 21:53 -0400
Re: Anonymous namespace Pete Becker <pete@versatilecoding.com> - 2011-06-02 16:00 -1000
Re: Anonymous namespace ruben safir <ruben@mrbrklyn.com> - 2011-06-02 22:40 -0400
Re: Anonymous namespace ruben safir <ruben@mrbrklyn.com> - 2011-06-03 02:29 -0400
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-03 20:12 +1200
Re: Anonymous namespace Ruben Safir <mrbrklyn@panix.com> - 2011-06-04 02:40 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 15:40 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 04:56 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 17:19 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:37 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 17:40 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:05 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 17:31 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:42 +0000
Re: Anonymous namespace Öö Tiib <ootiib@hot.ee> - 2011-06-03 06:08 -0700
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:09 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 17:32 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:39 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 17:45 +1200
Re: Anonymous namespace gwowen <gwowen@gmail.com> - 2011-06-03 01:08 -0700
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-03 20:17 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:08 +0000
Re: Anonymous namespace Victor Bazarov <v.bazarov@comcast.invalid> - 2011-06-03 09:44 -0400
Re: Anonymous namespace Ruben Safir <mrbrklyn@panix.com> - 2011-06-04 02:44 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 15:57 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:14 +0000
Re: Anonymous namespace "Bo Persson" <bop@gmb.dk> - 2011-06-04 11:33 +0200
Re: Anonymous namespace Michael Doubez <michael.doubez@free.fr> - 2011-06-03 03:10 -0700
Re: Anonymous namespace Ruben Safir <mrbrklyn@panix.com> - 2011-06-04 02:48 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 16:01 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:16 +0000
Re: Anonymous namespace Ian Collins <ian-news@hotmail.com> - 2011-06-04 17:34 +1200
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-04 05:01 +0000
Re: Anonymous namespace Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-09 11:26 +0000
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-10 04:12 +0000
Re: Anonymous namespace Michael Doubez <michael.doubez@free.fr> - 2011-06-10 01:49 -0700
Re: Anonymous namespace mrbrklyn <ceo.brooklyn@gmail.com> - 2011-06-10 10:34 -0700
Re: Anonymous namespace mrbrklyn <ceo.brooklyn@gmail.com> - 2011-06-10 10:45 -0700
Re: Anonymous namespace Michael Doubez <michael.doubez@free.fr> - 2011-06-12 00:01 -0700
Re: Anonymous namespace ruben safir <ruben@mrbrklyn.com> - 2011-06-13 04:08 +0000
Re: Anonymous namespace Michael Doubez <michael.doubez@free.fr> - 2011-06-13 08:43 -0700
Re: Anonymous namespace Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-10 18:27 +0000
Re: Anonymous namespace ruben safir <ruben@mrbrklyn.com> - 2011-06-13 05:02 +0000
Re: Anonymous namespace Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-13 07:58 +0000
Re: "namespaces were a mistake" (was: Anonymous namespace) Öö Tiib <ootiib@hot.ee> - 2011-06-13 09:56 -0700
Re: "namespaces were a mistake" (was: Anonymous namespace) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-13 19:52 +0000
Re: "namespaces were a mistake" Miles Bader <miles@gnu.org> - 2011-06-14 13:43 +0900
Re: "namespaces were a mistake" Miles Bader <miles@gnu.org> - 2011-06-15 07:15 +0900
Re: "namespaces were a mistake" Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-15 12:01 +0000
Re: "namespaces were a mistake" (was: Anonymous namespace) drew@furrfu.invalid (Drew Lawson) - 2011-06-14 12:24 +0000
Re: "namespaces were a mistake" (was: Anonymous namespace) gwowen <gwowen@gmail.com> - 2011-06-14 06:00 -0700
Re: "namespaces were a mistake" (was: Anonymous namespace) Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-14 14:10 -0700
Re: "namespaces were a mistake" Miles Bader <miles@gnu.org> - 2011-06-15 06:30 +0900
Re: Anonymous namespace Ruben Safir <ruben@mrbrklyn.com> - 2011-06-27 16:34 +0000
Re: Anonymous namespace Victor Bazarov <v.bazarov@comcast.invalid> - 2011-06-27 14:29 -0400
csiph-web