Recently voted into the C++0x working paper was an attribute syntax. This syntax provides a way to specify other pieces of information to the compiler. The Committee Draft also includes several standard attributes.
The syntax is to wrap the attribute list in double square brackets, e.g. [[noreturn]]
. These attributes can be "namespaced" in the sense that they are allowed to use :: to avoid name clashes (for instance, you might have [[windows::dllimport]]
), and can take parameters. They can be applied to virtually anything - types, objects, functions, statements, and so are extremely versatile. The current draft specifies the follwing attributes: [[align(number or type)]]
to specify an object's alignment, [[noreturn]]
to hint to the optimizer that a function won't return, [[final]]
to ask the compiler to prevent overriding (in this regard though, an implementation may ignore it), and [[carries_dependency]]
to indicate that the function carries a dependency (it's an optimizer thing added with the threading system that I don't really understand myself).
A representative from Microsoft has stated that Microsoft "refuses" to implement these attributes (quotation from the minutes of the last meeting). This is a travesty, as a major compiler not implementing such an important feature is a disaster for the standard (export
is different in that it is extremely difficult to use and very rare; these attributes stand to become on of the most easy-to-use features of C++0x)
So I ask you what attributes you guys would like. Perhaps we can take some of the most popular ones and attempt to get a vendor-neutral extension standard going, and hopefully get a very powerful addition to C++.