关键词搜索

源码搜索 ×
×

VC++, VC#, VB.NET 编码规范 (微软一站式示例代码库)

发布2022-06-02浏览448次

详情内容

vb.net教程icon-default.png?t=M4ADhttps://www.xin3721.com/eschool/vbnetxin3721/

 

经过三个月的不懈努力和反复检查,我们项目组终于完成了一份80页的VC++, VC#, VB.NET 编码规范。所有一站式示例代码库里的示例代码将以此为标准进行编写。我也希望这份编码规范能或多或少帮助到博客园里的朋友们编写更加优质统一的代码。

 

下载地址:http://1code.codeplex.com/releases/50431/download/141770

 

 


该文档主要分为三块:

General Coding Standards (即VC++, VC#, VB.NET 共通的一些编码规范)

C++ Coding Standards (C++ 特有的编码规范)

.NET Coding Standards (VC#, VB.NET 特有的编码规范)

 

该文档编写过程中得到了不少微软专家级开发工程师的审阅。文档中包含不少产品组使用的编码 best practices。比如:

Do use sizeof(var) instead of sizeof(TYPE). To be explicit about the size value being used whenever possible write sizeof(var) instead of sizeof(TYPE_OF_VAR). Do not code the known size or type of the variable. Do reference the variable name instead of the variable type in sizeof:

    Good:

    MY_STRUCT s;

    ZeroMemory(&s, sizeof(s));

    Bad:

    MY_STRUCT s;

    ZeroMemory(&s, sizeof(MY_STRUCT));

Do not use sizeof for arrays to get the element number. Use ARRAYSIZE.

 

这份编码规范仍在不断改进。如果你注意到一些good coding practice没有被记录在这份文档里,请告知我们: onecode@microsoft.com. 定予以重谢! :-)

相关技术文章

点击QQ咨询
开通会员
返回顶部
×
微信扫码支付
微信扫码支付
确定支付下载
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载