4 ms·
> it is a good fit for security-sensitive, heavily-audited codebases, because there are fewer layers of abstraction to audit and a smaller attack surface. C is
by bgorman 6y ago
> it is a good fit for security-sensitive, heavily-audited codebases, because there are fewer layers of abstraction to audit and a smaller attack surface.
C is a language that has a reason for existing. However C exposes programs to categories of errors that are not even possible to represent in other languages. In my opinion security code should be as error proof as possible, and C is definitely not a good language to accomplish that goal in. (I used to be a professional C programmer)
- woodrowbarlow 6y agosecurity code should be as _provably_ error-free as possible. C's strength in this regard is not due to any syntactical strengths, but due to how few layers exist between the code and the hardware. it's not the only option, maybe there are even some better options these days from a purely technical standpoint, but C is used in heavily-audited security-sensitive applications despite its syntactical/design shortcomings because it keeps you close to the metal.
- avmich 6y ago> C's strength in this regard is not due to any syntactical strengths, but due to how few layers exist between the code and the hardware. Any language compiling into native code has this advantage. You perhaps meant that in C the programmer actually codes closely to how it's going to look like in native code. That could be an advantage; but for that C brings disadvantages, which come from one actually having to code like this - there is no other way. The question what's more important - language constructs which are closer to actual hardware or language abstractions which prevent certain bugs from appearing - isn't that clear.