All code should have mandatory, compiler-enforced integer overflow and bounds checks at the very least.
All code should have mandatory, compiler-enforced integer overflow and bounds checks at the very least.
- Array implicit decay into pointers instead of requiring an explicit "address of" operator
- No bounds checking
- Implicit conversion between enumerations and numeric types
- Implicit conversions between numeric types
- Null terminated strings
Every time I had code in straight C, I made it look like Pascal by validating all the parameters, compiling with all warnings enabled, warnings as errors, using ADTs with no field access to structs.
A static analyzer is also compulsory.
The amount of money caused by bug fixing in developer time, creation of C memory corruption detection tools and paying for them is just endless.
You can deal with null-terminated strings.
You "just" have to be able to prove that all operations ensure a string remains postpended with a null, and doesn't get extended beyond the length of the underlying allocation.
By the time Windows was starting to be developed, UNIX was already established in the industry and was only natural to take ideas from it.
But yeah, eventually it also helped disseminate C. It was by then that I moved from Turbo Pascal into C++.
This has nothing to do with C's imperative, procedural, low-level programming style. It has everything to do with safety.