MISRA stands for "Motor Industry Software Reliability Association". IAR has an Embedded Workbench which I believe is a Tester to verify the implementation for the MISRA C rules.
Does KEIL have a such a tool?
If there a PDF document available that spells out the rules. I have search and all I can find are test suites.
"IAR has an Embedded Workbench which I believe is a Tester to verify the implementation for the MISRA C rules."
IAR's "Embedded Workbench" is their equivalent of Keil's uVision: it's their IDE, so it may well include a conformance tester, but it isn't in itself a conformance tester.
"If there a PDF document available that spells out the rules."
Yes - you have to buy it from MISRA: http://www.misra.org.uk/
Unfotunately, MISRA is one of the old-school standards bodies that insists on charging for its standards :-(
Thanks,
I asked the library (at work) to order it. I'm always looking to improve my coding style.
I'm always looking to improve my coding style.<p>
MISRA rules shouldn't be considered "good coding style", but a tool to remove some of the ambiguities of C in safety-critical applications.
There are some downright ridiculous rules contained in the MISRA-C standard. Some of them will boil down to "Program shall not contain bugs.", which is pretty much a rule for any program.
Another one, if followed to the letter, would turn a simple
a = b + c++;
into
a = (b + (c++));
There's also a a rule that forbids the use of goto. Have fun trying to exit that triple-nested loop.
MISRA is bullshit
such a statement guarantees that your code is.
Erik
why is you bee thinking that this????
a profffesional programer must learn all tools he can and finde best good ones to use for her job
i reed about it and think about it and learn abot it
sometime a tool you say not gggod is gooder by other me!!!!
i think sir eric can be good right sometime and you have code that is how you sayed it!!
plz dont be destruct commments and construct comment to help other peoples
thankyou
"I'm always looking to improve my coding style"
That's an excellent attitude!
Whether or not you choose to adopt it, an intelligent review of what MISRA (or any other guidance) says should be beneficial.
By looking at what MISRA (or any other guidance) says, and thinking about whether it is good, appropriate and/or worthwile in your particular circumstances you are (almost) bound to learn something!
:-)
"MISRA is bullshit"
That is an extremely foolish attitude.
by simply dismissing it like that out-of-hand, you are certain to learn nothing!
"out of hand"? I doubt that.
This was not about MISRA, but about something similar, and presenting it to someone I got the reaction "then it will not be real C" which I knew from that person ment "understandable and maintainable"
A general comment like "MISRA is bullshit" is the same as stating "I have no intention of writing good code"
You can write perfectly awful code even (or "especially") when following the MISRA rules religiously.
he write a general commment and is bad to be saying
i agreee wit eric that is bad but he is you are be writing generailisation????
generailly a generailisation not good you be thinking????
plz warming to the comment!
"You can write perfectly awful code even (or "especially") when following the MISRA rules religiously."
Indeed, quite awful code. There has been a length thread in comp.arch.embedded on this topic:
groups.google.com/.../492cec375ac59ba3
Hi,
its me, the bullshit man again ;-).
I really think that MISRA is more academic but not for professionals. i have a lot of yars experience in professional development of embedded devicec in very very big projects. I dont need a kindergarden-guidance like MISRA. one rule is "dont use nonstandard language extensions". this is simply not possible in reality, like many more rules.
understand me right, i am not against guidancees, but MISRA is one of the badest i have ever seen.
please you should be writing message good like thiis firstly and say reeson is nice yes
i thinking you not bigot now ;)
"one rule is "dont use nonstandard language extensions"."
So for example, when using Keil C51 plus MISRA-C guidelines, one is limited to the memory models selectable at the toolchain level and can't mix; that is, use a predominantly small model with xdata-qualified objects where needed?
Come to think of it now, one couldn't access SFRs either due to the way they are defined in the header files, right?
Does anybody use C51 plus MISRA-C guidelines?
MISRA C--A set of guidelines meant to stifle the artistic freedom of fun-loving C developers worldwide.
extracted from "
one is limited to the memory models selectable at the toolchain level and can't mix;
That's what that rule says, yes.
I feel really sorry for anyone who has to do this.
There are 'rules' in MISRA C that makes for better software
Of course. And of course those can be found in any book about good coding practices, along with the cases when it might make sense to break them (for example the "Goto must not be used." rule).
(for example the "Goto must not be used." rule).
that rule is broken "every day by everybody"
What is a switch statement but a bunch of "if - goto" statements?
HOWEVER, the C 'structure' does not lend itself very well to the implemetation of GOTO, so, thinking of it I have no assembler that is not full of GOTO and no C that has any.
that rule is broken "every day by everybody"<p>
If you want to write code in compliance with MISRA-C rules, you better not break that rule, or your code will not comply with the standard anymore.
Same thing goes for using a break; statement outside a switch/case structure, using a continue; statement, or using more than one return statement in a function.
"Same thing goes for using a break; statement outside a switch/case structure, using a continue; statement, or using more than one return statement in a function."
Oops! Bad Dan. Bad, bad Dan!
that rule is broken that rule is broken "every day by everybody"<p>
I did not say anything about that an actual GOTO statement was used "every day by everybody", what I said is that a switch statement is the equivalent of (if - goto) and thus if you use a switch statement (which MISRA allows) you are in fact using GOTOs.
"a switch statement is the equivalent of (if - goto)"
equiverlent of goto in 8051 is jmp yes
you be try writing assemblery with no jmp and yeou have only v little code you know
but docomenent is MISRA-C not MISRA-8051 so not good to say equiverelent switch if-goto
whot profffesional C coder do use goto????? i not know you know
i do not you thinking yes
goto really is useful in some situations.
However, all usage should be very similar to the usage of break and continue, but with the ability to make it multi-level, i.e. to break out of (or restart) more than one encapsulation.
You might have a function:
void fnk(void) { restart: do_something(); for (;;) { do_more(); switch (x) { case 1: if (error) goto fail; do_work(); break; case 10: do_even_more(); break; default: goto restart; } } fail: do_cleanup(); }
Yes, it is possible to solve all flow problems with flags, a large set of conditionals, and optional extra loops, but there comes a point where these flags gets very hard to read. The code must check if it should leave (or restart) first level, then second level, ...
I can not even imagine to apply each and every 'rule' in MISRA C but to state it is 'bullshit' is stating that every rule is 'wrong' which even you must admit is not true. There are 'rules' in MISRA C that makes for better software
Have you actually read the MISRA C guidelines?
"... but there comes a point where these flags gets very hard to read."
And thus become a potential source of errors themselves when the logic they control is not obvious.
Jack Sprat is a blabbering idiot that - without any such knowledge - claim to know what i do and do not do and I do not show such individuals diddlysquat.
View all questions in Keil forum