more about programming style

Wayne A. Christopher faustus at ucbcad.UUCP
Sat Jul 20 07:13:35 AEST 1985


> > if you write
> >
> >	while (p->duck)
> >		p++;
> >
> >instead of
> >
> >	while (p++->duck)
> >		;
> >
> 
> This will probably not be the only posting pointing out that your examples
> are different.  The first will leave p pointing to the first structure for
> which duck is zero; the second leaves it pointing one past it.

I didn't say they were the same, I was just trying to make the point that
the compiler might use a better strategy for compiling one than the
other. So I was careless -- I would never do such a thing in an actual
program, and if I did it wouldn't take long to discover and fix the
mistake...

	Wayne



More information about the Comp.lang.c mailing list