[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Feature request - compiler warning for"if"stmtsthat d
From: |
Anton Erasmus |
Subject: |
Re: [avr-gcc-list] Feature request - compiler warning for"if"stmtsthat do nothing |
Date: |
Fri, 17 Dec 2004 16:48:16 +0200 |
On 14 Dec 2004 at 9:26, E. Weddington wrote:
> David Breeze wrote:
>
> >
> >>I can't resist any longer. I always do this:
> >>
> >>
> >
> >
> >
> >>while ( *a++ = *b++ ) { }
> >>
> >>
> >
> >
> >
> >>This seems to me to state clearly that I haven't forgotten the body
> >>and that I intend it to be empty.
> >>
> >>
> >
> >
> >
> >
> >
>
> Oh, all right, I'll chime in too.
>
> I also do the above for the same reason. If someone *really* wanted to
> be pedantic, they could put in a comment:
>
> while(*a++ = *b++)
> {
> // Intentionally empty.
> }
>
>
> >Better! Also for those of us where safety is an issue "continue" and
> >"break" statements from while or for loops are to say the least
> >frowned upon/banned. See MISRA guidelines.
The latest misra guidelines has the following to say:
Rule 14.5 (required): The continue statement shall not be used.
> >
>
> Do you have link to a free copy of the MISRA guidelines?
>
A downloadable pdf version from MISRA itself is quite reasonably priced.
Definately a
worthwhile document to have even if one do not code according to their
guidelines.
Regards
Anton Erasmus--
A J Erasmus