I m looking to write some quality C code. Can someone point me to some articles , websites..whatever I need something with examples. I have already seen and read K&R C book.
But times have changed, some one must have more to say on quality C Code. and another important thing is How do you ensure that you as programmer have written quality C code??
There are a lot of aspects for quality of code and tons of articles, books, blogs
but I can advice you this ones as beginning:
Code complete
Code secure
Enable warnings in your compiler. With gcc, I use these flags:
If your code can't be changed to not produce warnings, drop the
-Werror
or don't use the specific flag producing the warning.Use a static analysis tool, traditionally called lint, however I've used splint which is good. See recommendations in this question. Personally I'd recommend enabling warnings and fixing them.
In terms of the rules
Edit: Specific to C, this list of C gotchas is essential reading, and even though it is for C++ it is worth going through the CERT C++ Secure Coding Standard
People have so far mentioned tools. However, beyond a certain point, there is really only one thing you can do to really improve the quality of the code you write:
Write code.
Some modern software lifecycle practices that enforce quality of code:
The latter one may in particular apply to the C language.