datasheets.com EBN.com EDN.com EETimes.com Embedded.com PlanetAnalog.com TechOnline.com  
Events
UBM Tech
UBM Tech
Welcome Guest Log In | Register

A Simple Style for C Programming

Authored on: May 31, 2010 by Meetul Kinariwala

Technical Paper

1 11
More InfoLess Info
C is a beautiful programming language, one that is close to the system and at the same modular, no wonder it lies at the heart of most embedded systems. Like most other languages it provides freedom in style of coding. This does not help when programs and number of programmers grow large. Therefore for ease of reading, understanding and sharing C programs among several team members, Mansi Research uses this simple style of C programming, which, in our opinion, is a good balance between simplicity and purpose.
View
 
11 comments
write a comment

No Avatar

wsch1 Posted Jul 3, 2013

I would use the MISRA standard instead, adopted to omit rules your organization does not think are valuable. -Its been subject to peer review and commentary for a long period of time, and has probably been subject to more criticism than the opinions of the elders (or whoever is writing the coding guide) in your department. -There are tools to detect MISRA violations; without measuring and enforcing compliance economically, nothing will be gained.

reply

No Avatar

barheine Posted Jul 12, 2013

I have the same opinion. But many developers seem still to believe that the MISRA rules are only interesting for the automotive industry, That's not the case. Since many years, I use MISRA-C and C++ for many applications like control units of machines in the mechanical industry in order to improve the software quality and its reliability.

reply

No Avatar

piyush_ Posted Jul 11, 2013

This paper is at a very basic level on the topic it is covering, it is surprising why it has made it to this site. The author is advised to read some books like Code Complete 2. There is a dangerous suggestion in this paper "Type conversion warnings must be suppressed in full knowledge of them, using casts." Warnings should not be suppressed by resorting to casting, it is an escape route. Every need for casting should be questioned fundamentally to see why there is a need in the first place, because casting indiscriminately can mask design and coding errors.

reply

No Avatar

mkinarivala Posted Aug 27, 2013

Thank you all for your valuable comments. As a embedded systems design firm, most of our engineers juggle around a dozen odd coding styles, each of which is generally a proprietary requirement by a different customer. However, when not mandated by a customer, the idea was to use a style which was just simple and concise and which simply addressed our key readability concerns over the years. There is no denying that casting must be used carefully and only as a last resort. We've had a number of occasions however where casting has been indispensable, especially in several battery powered embedded systems where complex floating point computations are coded in integer arithmetic (for a lean CPU awake duty-cycle). Casting becomes very useful when a few short lines of floating point calculations are inserted in between integer arithmetic, especially after all other tricks such as look-up tables have been exhausted. The paper recommends a full knowledge while using casts (successfully) and suppression of related warnings. To conclude, we would certainly look at addressing our needs using a MISRA subset.

reply

No Avatar

regalman101 Posted Jul 26, 2014

Quality articles or reviews is the crucial to invite the users to pay a visit the web page, that’s what this website is providing. regal assets llc

reply

No Avatar

jon_yein Posted Sep 10, 2013

Though I rarely comment on this kind of stuff, this article in particular caught my attention. The paper seems to focus on important visual rules. It looks as if it has been authored with certain goals in mind. Nevertheless, I won't be surprised if the paper comes under critique by style zealots who care to spend a lifetime around styles and rules promoting their own to be better and complete. IMHO and from my 27 years of industry experience, the styles proposed in the paper have taste and readability.

reply

No Avatar

regalman101 Posted Jul 26, 2014

You are so interesting! I do not think I’ve read something like that before. So great to discover somebody with a few original thoughts on this subject matter.Seriously.. many thanks for starting this up. This site is something that is required on the web, someone with a little originality! top rated gold ira companies

reply

No Avatar

regalman101 Posted Jul 26, 2014

Quality articles or reviews is the crucial to invite the users to pay a visit the web page, that’s what this website is providing. regal assets llc

reply

No Avatar

RichardS203 Posted Sep 10, 2014

C is a beautiful programming language, one that is close to the system and at the same modular, no wonder it lies at the heart of most embedded systems. Like most other languages it provides freedom in style of coding. This does not help when programs and number of programmers grow large. Therefore for ease of reading, understanding and sharing C programs among several team members, Mansi Research uses this simple style of C programming, which, in our opinion, is a good balance between simplicity and purpose. BlogHuts

reply

No Avatar

prince2training Posted Sep 25, 2014

Hi Mansi, great article. remember programmers should not only stick to just coding. it is inherent that they should also have some knowledge of project management. C is a wonderful language but I have often times failed to impress my clients simply because I lack the knowledge of project management to coordinate such effort. I speak to them and tell them how something can be achieved but I usually fail to identify the hours and the amount of work required to do the work. I suggest getting certified is some form of project management such as say Prince2 Training. this will not only save you time but also look good on your part because you approached it using some management.

reply

No Avatar

prince2training Posted Sep 28, 2014

Hi Mansi research, great article. remember programmers should not only stick to just coding. it is inherent that they should also have some knowledge of project management. C is a wonderful language but I have often times failed to impress my clients simply because I lack the knowledge of project management to coordinate such effort. I speak to them and tell them how something can be achieved but I usually fail to identify the hours and the amount of work required to do the work. I suggest getting certified is some form of project management such as say PRINCE2 Training. this will not only save you time but also look good on your part because you approached it using some management.

reply

Please Login

You will be redirected to the login page

×

Please Login

You will be redirected to the login page

×

Please Login

You will be redirected to the login page