Why the option to use attributes in new ATL projects was removed from Visual Studio 2008?

扶醉桌前 提交于 2019-12-22 09:57:23

问题


This is the text from MSDN comment: "According to the book ATL Internals (2ed) the use of attributes is deprecated and should not be used in new ATL projects."

But WHY?!!


回答1:


In ATL these attributes were a compiler trick. They were not a core part of the platform like attributes in C#. They were also more confusing to debug than macros's and the method of dumping generated attribute code was a hassle.

I suspect another issue is likely to have been C++ compiler compatibility and standards-adherence. Attributes didn't make for more beautiful C++ code, and perhaps this syntax may be used in a future version of a real C++ standard.




回答2:


Appendix D of the book goes into this.

Attributed ATL requires compiler extensions, and the problems encountered include

  • debugging either code generated by the attribute or the interaction between the attribute and your code
  • no control over the code generated
  • bugs, especially around connection points


来源:https://stackoverflow.com/questions/50310/why-the-option-to-use-attributes-in-new-atl-projects-was-removed-from-visual-stu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!