Should the comma operator be removed in D2?

Ellery Newcomer ellery-newcomer at utulsa.edu
Tue Nov 17 11:30:18 PST 2009


Leandro Lucarella wrote:
> Ellery Newcomer, el 17 de noviembre a las 12:58 me escribiste:
>>>> void fun1(int a);
>>>> void fun1(Tuple!(int,int) a);
>>>>
>>>> fun1( (a=fizbang(), a+b) );
>>> These are not code ported from *C*.
>> all but the second fun1 are, and it could easily exist in D
> 
> We agree except for the *easily*. On the contrary, I think it would be
> extremely rare.
> 

I think by 'easily', I didn't exactly mean 'likely'.

Sure it would be rare. Use of comma operator is pretty uncommon itself,
from what I've seen (which doesn't include a lot of C code, however).
I'm just saying this is one instance where it would cause problems. want
another? how about this?

int fizzbizz;
int* bar;

int i = (fizzbizz, bar)[0];



More information about the Digitalmars-d mailing list