:: Re: [DNG] Studying C as told. (For …
Inizio della pagina
Delete this message
Reply to this message
Autore: Peter Olson
Data:  
To: Edward Bartolo, KatolaZ
CC: dng
Oggetto: Re: [DNG] Studying C as told. (For help)
> On June 23, 2016 at 10:48 AM Edward Bartolo <edbarx@???> 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.

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.

Peter Olson