Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coding Standards for pure C (not C++)

Tags:

c

coding-style

I come from a java background (from my CS classes) and a semester of C++. I am just finishing up a OpenCV project for my Co-Op that's in pure C, so I'm a bit late in asking this question.

What are the design processes and coding standards for pure C?

I'm familiar with object oriented programming, design and best practices. I'm just a bit at a loss at a non-object oriented language like C. Every single variable and function appears to be global. It makes it feel like a real mess to me.

like image 970
awakenDeepBlue Avatar asked Aug 11 '09 19:08

awakenDeepBlue


People also ask

What are the C coding standards?

A C coding standard is a set of rules for source code that is adopted by a team of programmers working together on a project, such as the design of an embedded system. Programming teams and companies write down their C coding standards for a variety of reasons but often bicker internally about which rules to follow.

What is Misra coding standards?

MISRA® is a set of C and C++ coding standards, developed by the Motor Industry Software Reliability Association (MISRA). What's more, MISRA a top coding standard for embedded industries, including automotive. And, MISRA ensures that C/C++ code is safe, secure, and reliable.

What is the naming convention in C?

The first character of the name should be a letter and all characters (except the period) should be lower-case letters and numbers. The base name should be eight or fewer characters and the suffix should be three or fewer characters (four, if you include the period).


1 Answers

You may be interested in checking out the answers to a similar question I asked not too long ago. Moreover, if you're interested in C style guides, you may want to take a look at this page since it is a repository for C (and C++) style guides. If you're in the mood for a good laugh, please take a look at the NASA C Style Guide. In particular, take a look at the massive comment... you'll know which one I'm talking about. Don't write comments like this please.

I personally recommend the Indian Hill C Style Guide with some modifications. Furthermore, you may want to purchase the book C Interfaces and Implementations if you're having trouble designing large-scale programs in C.

like image 57
6 revs, 5 users 72%Anthony Cuozzo Avatar answered Oct 10 '22 21:10

6 revs, 5 users 72%Anthony Cuozzo