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

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

问题描述

这是 MSDN 评论中的文字:根据 ATL Internals (2ed) 一书,不推荐使用属性,不应在新的 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天全站免登陆