How to determine maximum stack usage in embedded system with gcc?

GCC docs : -fstack-usage Makes the compiler output stack usage information for the program, on a per-function basis. The filename for the dump is made by appending .su to the auxname. auxname is generated from the name of the output file, if explicitly specified and it is not an executable, otherwise it is the basename … Read more

Implicit memory aliasing in for loop

The warning means, in short, that you are taking the address of a loop variable. This happens because in for statements the iteration variable(s) is reused. At each iteration, the value of the next element in the range expression is assigned to the iteration variable; v doesn’t change, only its value changes. Hence, the expression … Read more

Should I use the final modifier when declaring case classes?

It is not redundant in the sense that using it does change things. As one would expect, you cannot extend a final case class, but you can extend a non-final one. Why does wartremover suggest that case classes should be final? Well, because extending them isn’t really a very good idea. Consider this: scala> case … Read more

Dead code detection in legacy C/C++ project [closed]

You could use a code coverage analysis tool for this and look for unused spots in your code. A popular tool for the gcc toolchain is gcov, together with the graphical frontend lcov (http://ltp.sourceforge.net/coverage/lcov.php). If you use gcc, you can compile with gcov support, which is enabled by the ‘–coverage’ flag. Next, run your application … Read more