Short Bytes: Checked C helps a programmer avoid common mistakes while dealing with pointers in C. Microsoft’s Checked C research project aims to make the system software more reliable and secure. To do the same, Microsoft has open sourced Checked C, an extension of C programming language that adds the static and dynamic checking to C.
Checked C is an extension of C programming language that allows a coder to write C code that is guaranteed to be bound-checked.
Most of the system software is written in C or C++ (which is based on C). So, very often system programmers feel the need of a system programming language that detects and prevents common errors involving pointers. Checked C provides this functionality and adds extra security and reliability to the system code.
How does Checked C help in error detection?
In C, pointers are used by programmers to access data. While using it to address a memory cell, it’s easy for a coder to commit mistakes, making the program read or write wrong data. Due to such errors, the programs could crash, misbehave, or allow themselves to be compromised.
Microsoft explains that Checked C allows the coders to describe the use of pointers in a better way. Using more information like the range of occupied memory, any pointer mistakes are detected at the runtime. This process is called “bounds-checking”. In usual C programming language, such mistakes go unnoticed.
Thus, just like its name suggests, Checked C adds the static and dynamic checking to C.
If you are aware of the concept of bounds checking, you might be knowing that languages like C# and Java already have this ability.
However, unlike the automatic addition of the information needed for bounds checking in these programming languages, a system software programmer needs to exercise more control over the program. Checked C brings this control and makes the code more secure and reliable.
Did you find this article helpful? Don’t forget to drop your feedback in the comments section below.