avr-gcc-list
[Top][All Lists]
Advanced

[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: E. Weddington
Subject: Re: [avr-gcc-list] Feature request - compiler warning for"if"stmtsthat do nothing
Date: Tue, 14 Dec 2004 09:26:29 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

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.


Do you have link to a free copy of the MISRA guidelines?

Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]