Fixing C source code from the internet using cake static analyzer
youtube.comCake is a open source compiler and static analyzer in development. (Not production quality yet.)
This video shows how cake can help programmers to create safe code just fixing warnings.
We copy paste code then we add pragma safety enable
This enables two features ownership and nullable checks. Ownership will check if the fclose is called for instance, also checks double free etc, while nullable checks will check for de-referencing null pointers.
New qualifiers _Opt and _Owner are used but they can be empty macros, allowing the same code to be compiled without cake.
That’s a very good example: realistic, very concise, and shows clearly how the annotations and checks work.