Attributes
Joseph S. Myers
joseph@codesourcery.com
Thu Jul 22 22:39:00 GMT 2010
I refer you to the various issues I have raised with attributes proposals
in WG14 in the past, some at least of which have also been forwarded to
WG21. The committees have generally chosen not to listen to compatibility
concerns, except insofar as WG14 ended up not adopting general attribute
syntax at all but instead adding new keywords for some particular uses of
attributes.
I also quote here something I sent off-reflector to Herb Sutter
(Microsoft) last September (see in particular the first paragraph
regarding treating [[]] as having clearly separate rules from
__attribute__):
[...] I'm also concerned about things for users. If I implement the
proposals in GCC, compatibility with existing code would inevitably mean
that __attribute__ follows existing rules for how it binds to syntax
constructs, and [[]] follows the different C1x rules, and
__attribute__((noreturn)) is part of the type system, and [[noreturn]]
isn't. This avoids breaking existing code, but is bound to confuse users
when they try to change syntax (likely with macros such as those you
mention) if they happened to be using cases where the two syntaxes bind
differently. When you have two similar but incompatible ways of doing
something, you have a no win situation for users - and it's not WG14's job
to create work for front-end writers implementing the different modes for
compatibility with different code, they should be helping users by
avoiding needing the different modes.
The fact that there are some problems with existing implementations
(including bugs where it may not be at all clear what is actually the best
thing to do), such as questions of exactly how attributes should interact
with the type system, may mean that a standard version cannot be perfectly
compatible with existing implementations in all cases. But by studying
what implementations actually do, and what real code using these features
does, and what problems have been noted in implementation over the years,
it ought to be possible to come up with something friendlier to users (and
less ambitious) than the existing proposals. So far however the proposers
of attributes standardization do not seem to have been paying any
attention to my points [...]
Issues we've observed in practice with how attributes interact with the
type system include those described in
<http://gcc.gnu.org/ml/gcc/2006-10/msg00318.html> and
<http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01056.html>.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list