Hi,
I am looking into C++11 generalized attributes and trying to understand
if they apply to namespaces, including the global namespace/translation
unit.
According to Clause 7 [dcl.dcl] paragraph 1 (the attribute-declaration
production), we can have something like this:
[[attr]];
namespace n
{
[[attr]];
}
However, I can't seem to find any text that says what such an attribute
appertains to. Is it to the innermost namespace? Or, may be, always to
the translation unit?
Revision 4[1] of the Generalized Attributes paper had this paragraph:
"In an attribute-declaration, the attribute-specifier appertains to its
innermost enclosing namespace; if that namespace is the global namespace,
the attribute-specifier appertains to the entire translation unit. In an
attribute-specification, the attribute-specifier appertains to all entities
declared or named within the declaration-seq, if any. Multiple attribute-
specification nest. When they nest, for each attribute, the innermost one
determines the attribute effective for all entities in the declaration-seq.
An attribute-specification does not establish a scope."
However, in Revision 6[2] this paragraph has been removed.
I would appreciate it if someone can clarify this.
[1]
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2553.pdf
[2]
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf
Thanks,
Boris
--
Boris Kolpackov, Code Synthesis
http://codesynthesis.com/~boris/blog
Compiler-based ORM system for C++
http://codesynthesis.com/products/odb
Open-source XML data binding for C++
http://codesynthesis.com/products/xsd
XML data binding for embedded systems
http://codesynthesis.com/products/xsde
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:
std-cpp...@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ:
http://www.comeaucomputing.com/csc/faq.html ]