Comma operator = broken design

Jonathan M Davis jmdavisProg at gmx.com
Fri Dec 9 10:11:25 PST 2011


On Friday, December 09, 2011 12:36:25 Regan Heath wrote:
> On Fri, 09 Dec 2011 11:39:55 -0000, Timon Gehr <timon.gehr at gmx.ch> wrote:
> > These are the occurences of the comma operator in directory 'std':
> Here is my /very/ quick re-write of each without looking at the context of
> each snippet. There may be much better re-writes in context. Re-writing
> this was problematic /because/ the comma operator makes things that much
> more confusing to me. Especially example #5 below where the last ,
> actually separates enforce parameters!
> 
> 1)
> 
> > return r2.empty ? (r1 = r, true) : false;
> 
> if (!r2.empty) return false;
> r1 = r;
> return true;

Actually, that particular usage of the comma operator makes me almost want to 
use it that way. It manages to take one of the type of statements that always 
irritates me when it's multiple lines and make it a single line.

- Jonathan M Davis


More information about the Digitalmars-d mailing list