Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Annotating C/C++ code [closed]

Tags:

c++

c

annotations

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?

like image 784
MxNx Avatar asked Jan 28 '14 06:01

MxNx


People also ask

What is _In_Opt_?

This is part of Microsoft's Source-Code Annotation Language . _In_Opt_ means you may pass NULL . Follow this answer to receive notifications.

Why we use annotation in android?

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.

Are there annotations in C++?

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.

What is SAL c++?

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.


1 Answers

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.

like image 71
Tony Richards Avatar answered Oct 10 '22 17:10

Tony Richards