注释 C/C++ 代码 [英] Annotating C/C++ code

查看:35
本文介绍了注释 C/C++ 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我掌握了 Microsoft 的标准注释语言 (SAL) 用于注释 C/C++ 源代码.这个特性对于调试和开发过程非常有帮助,但不幸的是它不是一个可移植的跨平台库.是否有任何用于注释 C/C++ 代码的标准或开源工具?gcc 中是否有类似的功能?

Recently I got a grasp of Microsoft's Standard Annotation Language (SAL) for annotating C/C++ source codes. This feature can be very helpful for debugging and during development but unfortunately it is not a portable cross-platform library. Is there any standard or open-source tool for annotating C/C++ codes? Is there a similar feature available in gcc?

推荐答案

我所知道的最接近的是 GCC 的属性,但其他编译器不支持该语法.GCC 属性语法不支持与 SAL 一样多的注释,但您可能会发现其中一些注释很有用.

The closest that I'm aware is GCC's attributes, but other compilers don't support the syntax. GCC attribute syntax does not support as many annotations as SAL, but you may find some of the annotations useful.

或者,如果您使用模板,您可能需要查看 Boost Static断言,大多数编译器都支持.

Alternatively, if you're using templates, you may want to check out Boost Static Assert, which most compilers support.

还要注意CLANG支持的注解比GCC多,使用CLANG的静态分析器可能更接近你想要.

Also note that CLANG supports more annotations than GCC, and using CLANG's static analyzer may be closer to what you're wanting.

这篇关于注释 C/C++ 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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