OT: for (;;) {} vs while (true) {}

Nick Sabalausky via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 1 08:23:26 PST 2016


On 11/24/2016 05:09 PM, Dennis Ritchie wrote:
> On Thursday, 24 November 2016 at 22:04:00 UTC, LiNbO3 wrote:
>> As you can see [1] the `while (true)` is lowered into `for (;true;)`
>> so it's all about what construct pleases you the most.
>>
>> [1]
>> https://github.com/dlang/dmd/blob/cd451ceae40d04f7371e46df1c955fd914f3085f/src/statementsem.d#L357
>>
>
> OK, thanks.
>
> The next question is:
> What principles guided when choosing between `for (;;) { ... }` and
> `while (true) { ... }` ?

Personal preference. Nothing more. Programmers have far better things to 
do that fret over the relative merits of two identical constructs that 
have no relative (de)merits over each other.



More information about the Digitalmars-d mailing list