if (int x=..) but no while(int x=..) ?

Lionello Lunesu lio at lunesu.remove.com
Tue May 2 01:45:34 PDT 2006


Lionello Lunesu wrote:
> I like the fact that we can do
> 
> # if (int recvd = ts.receive(buffer)) {...}
> 
> but is there any reason why this shouldn't apply to "while" also?
> 
> # while (int recvd = ts.receive(buffer)) {...}
> 
> main.d(26): found 'recvd' when expecting '.' following 'int'
> main.d(26): found '=' when expecting identifier following 'int.'
> main.d(26): found 'ts' when expecting ')'
> main.d(26): found ')' when expecting ';' following 'statement' 

*BUMP*

What's the status on this issue? Is there any reason why the syntax of 
"while" is different from the syntax of "if" ?

According to tests done by Kelly Wilson it's trivial to support.

Sorry for the bump, but this seems like a forgotten issue.

L.



More information about the Digitalmars-d mailing list