Well, that sentiment can cut both ways. Why should we spend a lot of time (most of it non-productive) mucking with a web forum because MISRA can't be bothered to use anything better than a lowest common denomina- tor communications mechanism?
Well, that sentiment can cut both ways. Why should we spend a lot of time (most of it non-productive) mucking with a web forum because MISRA can't be bothered to use anything better than a lowest common denomina- tor communications mechanism?
-- /"\ ASCII Ribbon Campaign | \ / | Email to user 'CTZ001' X Against HTML | at 'email.mot.com' / \ in e-mail & news |
It's also good for the original poster - the discussion is held in a place that suits him. If he (or others) are looking for more expert help, then of course they must go where the experts hang out - i.e., the MISRA forums.
If this thread had found something important and relevant to MISRA, then you should spend that time - because MISRA is important to *you*. MISRA is of no importance to *me* - this thread is just an excuse to think about C coding and style rules that are of interest to embedded programming in general. So if something relevant to the MISRA team had come up, then why should *I* spend time telling them? I would already know about the problem, as would the original poster, and the others in the thread - why should I then spend extra time helping an unrelated (to me) commercial group do their job?
In actual practice, if I had found something worth bothering the MISRA team about, then I would have told them (assuming you didn't), just because I think it might help other people. But I don't think it's appropriate for you to imply that I have some sort of duty to spend extra effort passing information on to anyone. It would be a different matter if I were using MISRA's work, of course.
... snip ...
Sounds like a rather foul attitude. I hope I am mistaken.
-- Chuck F (cbfalconer at maineline dot net) Available for consulting/temporary embedded and systems.
Chris, To be fair here, I don't think anyone expects you to transpose this lot onto another system, however there is no reason why you can't take on board (as a MISRA representative) any relevant points/problems raised. I think that was David Brown's message! Regards, Richard.
Thanks, just read through it. It is somewhat clarifying.
It says on page 13 that type conversions should be avoided, something I agree on, and that temporary variables might be required. I can see a problem with for example this expression: (uint32_t) (u16a + u16b)
If the complex overflows this cast is not helping one bit, but can on the contrary lead you to think there is no problem.
I do tend to cut and past stuff across.
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
In article , Tom Ziomek writes
I can;t disagree but it is the way of the world
Your choice
Probably.
-- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ /\/\/ chris@phaedsys.org www.phaedsys.org \/\/\ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Being a bit extreme, aren't we? Have you ever tried writing the support functions for C without using casts? It's difficult to do very much with void * arguments without casting them to something.
... snip ...
The thing to do with void* arguments is to copy them to known pointer types. No casts are needed for this, and the compiler can check everything properly. When you cast you are overriding the compilers error messages and warnings. For example:
void memcopy(void *from, void *to, size_t lgh) { unsigned char *f = from, *t = to;
if (from && to) while (lgh--) *t++ = *f++; }
-- Chuck F (cbfalconer at maineline dot net) Available for consulting/temporary embedded and systems.
In news:f9d3og$1ng$ snipped-for-privacy@engnntp2.cig.mot.com timestamped Wed, 8 Aug 2007
18:58:24 +0000 (UTC), snipped-for-privacy@gauley.ddna.labs.mot.com (Tom Ziomek) posted: |-----------------------------------------------------------------------| |"[..] | | | |[..] MISRA | |can't be bothered to use anything better than a lowest common denomina-| |tor communications mechanism? | | | |-- | | /"\ ASCII Ribbon Campaign | | | \ / | Email to user 'CTZ001' | | X Against HTML | at 'email.mot.com' | | / \ in e-mail & news |" | |-----------------------------------------------------------------------|What is ASCII if not "a lowest common denomina-tor communications mechanism"?
I posted this reply on MISRA-Cs forum because it was the best answer I could find in the thread. They have now answered:
"10.3 and 10.4 do apply to explicit casts. They are in the section
6=2E10.7 entitled "Explicit conversions (casts)".Therefore the example above clearly illustrates the intent of MISRA-C and is correct in its reasoning."
So I think that will conclude the discussion. Thanks for the contributions everyone.
- Eirik
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.