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

Kyle Furlong kylefurlong at gmail.com
Tue Mar 14 22:10:01 PST 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' 
> 
> 

Seems an obvious next step, are there any drawbacks that people can think of?



More information about the Digitalmars-d mailing list