I am inheriting a fairly large code base which unfortunately exhibits a lot of "bad habits". One of my largest personal pet peeves is declaring several variables in one expression like this:
int x, y, z;
personally, I prefer:
int x;
int y;
int z;
this allows me to easily adjust the types individually, and avoids issues with pointer types like this:
int *x, y, z; // whoops I meant to make y and z pointers too!
Also, I'd love to detect when a type whose size is bigger than sizeof(void*)
is being passed by value.
There are other "style" issues I'd like to detect and correct as well, but these are the most annoying IMO. What are the best tools for this?
One of the best tools I have used, for checking the style of C++ files is the KWStyle. However I am not quite sure if it supports all your requirements.
I use Artistic Style or astyle for formatting my codes of C++ and JAVA since about 2 Years.It can be customized in great detail.Probably there are many better ones now...
But Its Very useful to me.
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