Annotating C/C++ code

annotations, c, c++

Solution

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.

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

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

Problem

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?

Original source