Should we deprecate comma?

Byron byron.heads at gmail.com
Tue Mar 25 07:00:28 PDT 2014


On Sun, 23 Mar 2014 20:09:45 -0700, Andrei Alexandrescu wrote:
> 
> 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

This would be a red flag in my code review, nested ternaries are to hard 
to read and even worse for maintainability.  Been bit to many times with 
little bugs in them.  Wish compilers would throw a warning when they are 
used.   


More information about the Digitalmars-d mailing list