天天看點

VS2008 不在支援 Attributed ATL

從VS2008的What' new 來看,VS2008已經不在支援ATL屬性程式設計.相關描述見下:

The ATL Project wizard no longer provides an option to create attributed ATL projects. Beginning with Visual Studio 2008, the ATL Project wizard does not have an option to change the attributed status of a new project. All new ATL projects that the wizard creates are now unattributed.

原因呢,搜了一下網上的文章

If you open an attributed project in a wizard, the box will be checked, but
it will still be disabled.  There is obviously some reason the ATL Devs
decided to deprecate attributed ATL in this version.  We are trying to
contact Dev team for confirmation on this.

Anyway based on the template source, it is true that attributed ATL is
deprecated, so we recommend that you use non-attributed COM projects in
VS2008.      
已經說的很明白了,從vs2008開始,屬性程式設計漸漸被廢棄掉了,微軟ATL團隊并不推薦用屬性程式設計來進行COM開發.      
This is the text from MSDN comment: "According to the book ATL Internals (2ed) the use of attributes isdeprecated and should not be used in new ATL projects."

 
  看來屬性程式設計的問題不少.
 
 
  
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.

  
 

  
 

  
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

這裡原因已經講到很明白了.自己看去吧.

繼續閱讀