From the course: Secure Coding in C

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Documenting everything

Documenting everything - C Tutorial

From the course: Secure Coding in C

Start my 1-month free trial

Documenting everything

- [Instructor] One golden arrow in your coding quiver is documentation. Always comment your code. Use the comments to describe what the code does, but also as a diary to explain to your future self, or any fellow programmer, how the code works. Documentation is an important part of secure programming. Sadly, documentation is usually the last thing you think of and often programmers are in a hurry to create useless documentation, such as put five into X. This type of comment is done out of haste, which is why I believe the best comments are written after you get the code correct. Still, while you're coding try to add a reason or philosophy to the comment. So X equals five, you could say set the number of retries or better, use descriptive variable names which self comment. Better still, for each of your own functions document the function's purpose, it's arguments, and any return values. Describe valid ranges,…

Contents