qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Stitcher (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-4005) Eliminate "using" especially "using namespace" from header file
Date Wed, 16 May 2012 22:25:06 GMT

    [ https://issues.apache.org/jira/browse/QPID-4005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13277207#comment-13277207
] 

Andrew Stitcher commented on QPID-4005:
---------------------------------------

There is really a hierarchy of badness here:

Worst:

"using namespace" In the global scope of a header file - This pollutes the namespace of any
using source file.
"using <declaration>" In the global scope of a header file - This may cause some unexpected
symbol resolution which will be affected by which header files are included - tricky to diagnose
if it happens.

These previous are especially bad if they are in exported headers because they affect programs
which merely use a qpid library.

Bad:

"
namespace qpid { ... using ...;
"

This can still cause the above problems and confusions to qpid developers but at least have
little to no chance of confusing library users.


Probably not actually harmful:

Using "using  ... " inside a block scope generated by a macro in a header file. Questionable
from a taste point of view, but can't pollute anyone elses namespace.
                
> Eliminate "using" especially "using namespace" from header file
> ---------------------------------------------------------------
>
>                 Key: QPID-4005
>                 URL: https://issues.apache.org/jira/browse/QPID-4005
>             Project: Qpid
>          Issue Type: Improvement
>          Components: C++ Broker, C++ Client
>            Reporter: Andrew Stitcher
>            Priority: Minor
>
> The using declaration is generally unsuitable for use in header files as it affects the
namespace of any file including that header file.
> This can make the C++ build unstable under code maintenance.
> We should remove using and using namespace from header files and replace it where necessary
in the C++ source files that previously relied on the declaration.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message