On Thu, Jun 23, 2016 at 11:34:23PM -0400, Peter Olson wrote:
> > On June 23, 2016 at 10:48 AM Edward Bartolo <edb...@gmail.com> wrote:
> >   if (count > 0)
> >     while(putchar(' ') && --count);
> 
> I strongly recommend using the continue statement here:
> 
>       while(putchar(' ') && --count) continue;
> 
> The reason is that the semicolon by itself is almost unnoticeable 
> and you can create a difficult to understand malfunction if you don't 
> notice you forgot to type it.

I learned C in the 70's.  I still seem to have things to learn.  And this
possibility has been there all that time.

Thank you.

-- hendrik

> 
> Another habit I have is to avoid a statement like:
> 
>     if (abc == 42)
> 
> and write it as
> 
>     if (42 == abc)
> 
> instead.  The compiler will issue an error message if you type only 
> one = in the latter form, whereas the first form will happily execute 
> by setting abc to 42 and always taking the true clause.

I had figured this one out.

-- hendrik
_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to