Bug 21494 - condensed nested namespaces
Summary: condensed nested namespaces
Status: RESOLVED DUPLICATE of bug 65047
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-10 15:43 UTC by Benjamin Kosnik
Modified: 2015-03-23 14:18 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-12-07 03:56:52


Attachments
proposal (3.20 KB, text/plain)
2005-05-10 15:44 UTC, Benjamin Kosnik
Details
Implementation of condensed nested namespaces definition, includes testcase. (1.65 KB, patch)
2005-12-09 12:54 UTC, Petr Machata
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Kosnik 2005-05-10 15:43:54 UTC
Instead of 

namespace __gnu_cxx
{
namespace detail
{
}
}

would like to experiment with the form

namespace __gnu_cxx::detail
{
}

See N1524 from pre-Kona. Will attach for reference
Comment 1 Benjamin Kosnik 2005-05-10 15:44:50 UTC
Created attachment 8853 [details]
proposal


At Kona, this seemed uncontraversial.
Comment 2 Andrew Pinski 2005-05-10 17:49:19 UTC
Confirmed.
Comment 3 Benjamin Kosnik 2005-12-07 00:16:26 UTC
I still want this. 

Someday...
Comment 4 Petr Machata 2005-12-09 12:54:35 UTC
Created attachment 10444 [details]
Implementation of condensed nested namespaces definition, includes testcase.

I sent an email with some comments to gcc-patches:
http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00666.html
Comment 5 Benjamin Kosnik 2005-12-14 17:16:15 UTC
I'm encouraged by this work!!! Great news.

The reason this would be useful is that then it would be possible to use a single macro to represent both scope and namespace. Ie, 

#define ACTIVE_SCOPE

works for

namespace ACTIVE_SCOPE
{
}

and explicit qualifications like

ACTIVE_SCOPE::obj;

Anyway.

-benjamin
Comment 6 Gabriel Dos Reis 2005-12-15 03:40:34 UTC
Subject: Re:  condensed nested namespaces

"bkoz at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Comment #5 from bkoz at gcc dot gnu dot org  2005-12-14 17:16 -------
| 
| I'm encouraged by this work!!! Great news.
| 
| The reason this would be useful is that then it would be possible to use a
| single macro to represent both scope and namespace. Ie, 
| 
| #define ACTIVE_SCOPE
| 
| works for
| 
| namespace ACTIVE_SCOPE
| {
| }
| 
| and explicit qualifications like
| 
| ACTIVE_SCOPE::obj;
| 
| Anyway.

I see what you mean.  However, as ever, macro-based tehcniques just
don't play nicely with othe scope rules.  

When I read the code, I don't want to be deceived.  When I see

    namespace ACTIVE_SCOPE { /* blah blah */ }

I really think of a named scope.  Later, when I see
ACTIVE_SCOPE::obj, I really think of the obj found in ACTIVE_SCOPE 
through usual rules.  However, if ACTIVE_SCOPE is #defined to nothing,
then that breaks down -- the obj found is not the one from the unnamed
namespace through usual rules.  
So. while I believe this work can be useful, I'm not convinced that
the macro-based techniques make a case for the extension that would
require a different set of lookup rules.

-- Gaby
Comment 7 Jonathan Wakely 2015-03-23 14:18:02 UTC
Something like this is in the C++17 WP

*** This bug has been marked as a duplicate of bug 65047 ***