Re: while (1) vs. for ( ;; )



Chris McDonald <chris@xxxxxxxxxxxxxxx> writes:

> Michael B Allen <mba2000@xxxxxxxxxx> writes:
>
>>Should there be any preference between the following logically equivalent
>>statements?
>
>> while (1) {
>>vs.
>> for ( ;; ) {
>
>>I suspect the answer is "no" but I'd like to know what the consensus is
>>so that it doesn't blink through my mind anymore when I type it.
>
> Preference? Why not move on to something whose intention is clear:
>
> while(true) {

In what way are the former two statements' intentions not clear?
Both of them obviously loop "forever".
--
A competent C programmer knows how to write C programs correctly,
a C expert knows enough to argue with Dan Pop, and a C expert
expert knows not to bother.
.



Relevant Pages

  • Re: while (1) vs. for ( ;; )
    ... > Michael B Allen wrote: ... >> Should there be any preference between the following logically equivalent ... > makes the intention of the programmer clearer. ...
    (comp.lang.c)
  • Re: while (1) vs. for ( ;; )
    ... Ben Pfaff writes: ... >>>Should there be any preference between the following logically equivalent ... Why not move on to something whose intention is clear: ...
    (comp.lang.c)
  • Re: while (1) vs. for ( ;; )
    ... > Chris McDonald wrote: ... >>>so that it doesn't blink through my mind anymore when I type it. ... >> Preference? ...
    (comp.lang.c)
  • Re: while (1) vs. for ( ;; )
    ... > Should there be any preference between the following logically equivalent ... whilewill be flagged by many compilers as "conditional expression is ...
    (comp.lang.c)
  • Re: while (1) vs. for ( ;; )
    ... Michael B Allen wrote: ... > Should there be any preference between the following logically equivalent ... Prev by Date: ...
    (comp.lang.c)