This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Assignment to volatile objects


On Mon, 30 Jan 2012 19:51:47 -0600
Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

> On Mon, Jan 30, 2012 at 4:59 PM, ZoltÃn KÃcsi <zoltan@bendor.com.au> wrote:
> > David Brown <david.brown@hesbynett.no> wrote:
> >
> >> Until gcc gets a feature allowing it to whack the programmer on the back
> >> of the head with Knuth's "The Art of Computer Programming" for writing
> >> such stupid code that relies on the behaviour of volatile "a = b = 0;",
> >> then a warning seems like a good idea.
> >
> > a = b = 0; might be stupid.
> >
> > Is if ( ( a = expr ) ); is also stupid?
> 
> If you ask me, yes.

Beauty is in the eye of the beholder, I like

while (( *dst++ = *src++ ));

better than

_some_type_ tmp;

do {
  tmp = *src;
  *dst = tmp;
  src = src + 1;
  dst = dst + 1;
} while ( tmp != 0 );


Zoltan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]