|
|
|
|
|
by keithnz
3503 days ago
|
|
Looking at their example code.... I find there is a lot of problems, duplicated code, large function with many many obvious simpler functions inlined causing lots of local variable pollution. MISRA is another standard that's popular and I've seen a bunch of code developed using this standard. But the problem with style guides, they have lots of points that are very agreeable, but it is all undone if you don't have clean well designed code. I've seen too much emphasis on conforming to the style guide (often because of contractual agreements on the developed code). But the more important part of making the code clean gets less attention because it is harder to quantify and harder to enforce via static analysis. however, that doesn't mean it's a bad thing to have, it's just that conformity to a style guide is a very low bar in terms of quality. |
|
Style is concerned with the appearance of the code, and is largely subjective. Many languages, like Common Lisp and Java, have got this nailed: the same style is used everywhere. In the C world, there are endless arguments about levels of indentation, the position of braces, etc.
Standards ensure that good, safe, coding practices are followed. For C, these are needed for many applications because the language is weakly typed and inherently unsafe in many ways. Other languages, such as Ada, have safety built into the language.