Should we deprecate comma?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Mar 23 20:09:45 PDT 2014


On 3/23/14, 7:50 PM, Adam D. Ruppe wrote:
> int a = something == 1 ? 1
>        : something == 2 ? 2
>        : (assert(0), 0);

That was in Phobos too. Fix:

int a = something == 1 ? 1
        : something == 2 ? 2
        : { assert(0); return 0; }();

There are of course other ways, too, including defining a function that 
returns its last argument.


Andrei



More information about the Digitalmars-d mailing list