为什么从Visual Studio 2008中删除了在新的ATL项目中使用属性的选项? [英] Why the option to use attributes in new ATL projects was removed from Visual Studio 2008?

查看:114
本文介绍了为什么从Visual Studio 2008中删除了在新的ATL项目中使用属性的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是MSDN注释中的文本:根据ATL Internals(第2版)一书,不建议使用属性,并且不应在新的ATL项目中使用."

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."

但是为什么?!

推荐答案

在ATL中,这些属性是编译器的把戏.它们不像C#中的属性那样是平台的核心部分.与宏相比,它们还更容易调试,并且转储生成的属性代码的方法很麻烦.

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.

我怀疑另一个问题可能是C ++编译器的兼容性和标准遵循性.属性并不能构成更漂亮的C ++代码,也许将来的实际C ++标准版本中可能会使用此语法.

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.

这篇关于为什么从Visual Studio 2008中删除了在新的ATL项目中使用属性的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆