LLVM Coding Standards

Don nospam at nospam.com
Mon Apr 11 21:11:39 PDT 2011


Spacen Jasset wrote:
> While I am on the subject, I've *always* thought major languages have 
> poor loop constructs:
> 
> 
> (A)
> 
> for (;;)
> {
>     std::getline(is, line);
>     if (line.size() == 0)
>         break;
>     ...some things...
> }
> 
> 
> You have to call getline always at least once, then you need to test if 
> the line is empty to terminate the loop. So how do you do it another way?

FORTH had BEGIN ... WHILE ... REPEAT. I really miss it.
C family languages just have do ... while, which seems to be pretty much 
useless.


More information about the Digitalmars-d mailing list