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?
This is part of Microsoft's Source-Code Annotation Language . _In_Opt_ means you may pass NULL . Follow this answer to receive notifications.
Annotations allow you to provide hints to code inspections tools like Lint, to help detect these more subtle code problems. They are added as metadata tags that you attach to variables, parameters, and return values to inspect method return values, passed parameters, local variables, and fields.
The C++ Annotations are also available as a Kindle book. Don't hesitate to send in feedback: send an e-mail if you like the C++ Annotations; if you think that important material was omitted; if you find errors or typos in the text or the code examples; or if you just feel like e-mailing. Send your e-mail to Frank B.
SAL is the Microsoft source code annotation language. By using source code annotations, you can make the intent behind your code explicit. These annotations also enable automated static analysis tools to analyze your code more accurately, with significantly fewer false positives and false negatives.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With