5 ms·
Comments on the MISRA C coding guidelines (2012)
- NinoScript 9y ago(Last modified 10 October 2012)
- notlob 9y agoN.B., the MISRA guidelines for C were revised in 2012. This critique is directed at an older publication.
- 0xcde4c3db 9y ago> Some rules have their basis in psychological findings, i.e. how developers read the source. Such issues are not important in machine generated code (because such code is never read by humans). I wish. Sometimes code generators are also bug generators.
- legulere 9y ago> Software developers working in countries whose keyboards do not offer all of the characters required to write C programs will require special equipment, or to break this rule. I've never seen C code actually using trigraphs. The way I heard it, is that different charactersets in the 70s didn't contain all characters for C. This was not a problem in 2012 and not even in 2002 or even 1992 I think.
- amadvance 9y agoItalian keyboards don't have { and }. In DOS I was using ALT+1+2+3 and ALT+1+2+5. Now in Linux, I use SHIFT+ALT+[ and SHIFT+ALT+] After some time, muscle memory does the work, and you don't even realize.
- deleted 9y ago[deleted]
- lmilcin 9y agoI am guilty of using trigraphs on a day to day basis. It is useful tool to make code more readable but you really have to restrict yourself to only use it for very simple and easily recognizable idioms if it is to work as intended (make it more readable). Sadly, most devs (especially at large corporations) don't go out of their way to pay attention to such details and so overall I'm in favor of rules that restrict constructs that can very easily be abused. As my career progresses and I'm spending more of my time reading, evaluating and diagnosing code, I got a new perspective on being smart when writing code. Now I think, if you are smart, you will write most plain code possible. If your code looks smart then you are probably doing something wrong. There is very few problems that actually require smart looking code.
- AnimalMuppet 9y ago> Rule 6: This rule excludes the use of an EBCDIC character set. No use of IBM 370's in embedded systems. Yeah... um... I wasn't really intending to use a 370 anyway, but thanks for pointing it out.
- dguaraglia 9y agoWhat? You've moved on already?
- AnimalMuppet 9y agoHad to. The weight of the 370 was killing the gas mileage. ;-)