Live data from Hacker News

NASA C Style Guide [pdf]

homepages.inf.ed.ac.uk

1–10 of 33 posts

Re: NASA C Style Guide [pdf]

#7
post #3

4 space indentation and not tabs. What would Hendricks say?!

Tabs really only works easily when everyone's using the same editor settings. Otherwise, it quickly devolves into a mess.

Spaces really only works easily when everyone uses an editor that can convert presses of the tab key into some number of space characters.

The only solution that works easily in all cases is to flatly refuse to collaborate with others.

Re: NASA C Style Guide [pdf]

#8
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.

Re: NASA C Style Guide [pdf]

#10
How strictly do people writing code have to adhere to styling guides (not just in NASA, but everywhere else too)?

I get that coding standards are a good thing and plain-simply following these will produce "readable" and (possibly) maintainable code, but will that make the code any _better/efficient_ ?

Though this does catch some "gotchas" in C, like the if-if-else and the #define trap, I wonder if the Code Review involves a guy rejecting my patches with the comments, "you have missed out guideline 6.4.3.5 defined in page 54".

Post reply on HN