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

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 25 00:52:21 PST 2016


On Friday, 25 November 2016 at 08:46:24 UTC, rikki cattermole 
wrote:
> On 25/11/2016 8:27 PM, unDEFER wrote:
>> Why you consider only 2 options?
>> Use "do {} while (true);" :-)
>
> The condition only executes after a single iteration.
> So it is not the same code flow.

For an the usecase infinite-loop the code has the same effect.
And will translate to the same machine-code, hopefully.



More information about the Digitalmars-d mailing list