On Wed, Dec 29, 2010 at 08:33:10AM -0500, Olin Lathrop wrote: > IVP wrote: > > if(diff >=3D 0) > > byte =3D 0; > > else > > > > { > > byte =3D 8; > > diff =3D - diff; > > } >=20 > I'm no C whiz (I can just about spell it), but that looks really messed u= p > to me. Hopefully someone that actually knows C will jump in, but doesn't > the ";" at the end of the second line end the IF statement?=20 Nope. It simply terminates the statement byte =3D 0; I always hated the fact that the braces were not required even when the body of a control statement consisted of a single statement. The inconsistency of making it optional is a bad idea. > If so, the ELSE must be part of a outer IF statement not shown? Nope. It's attached to that if. >=20 > Unfortunately C encourages such messily written code. Yucc. Agreed. When I wrote my own language, I put in an explicit ENDIF that made it very clear. In this example the else is attached: if (diff >=3D 0) byte =3D 0 else byte =3D 8 diff =3D -diff endif In the next example the else is attached to some other outer if: if (diff >=3D 0) byte =3D 0 endif else byte =3D 8 diff =3D -diff endif It completely eliminates the confusion by putting a clear marker of the end of the if statement. And it was always required, even if the body only consisted of a single statement. BAJ --=20 Byron A. Jeff Department Chair: IT/CS/CNET College of Information and Mathematical Sciences Clayton State University http://cims.clayton.edu/bjeff --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .