Comma operator = broken design
Jonathan M Davis
jmdavisProg at gmx.com
Fri Dec 9 01:26:09 PST 2011
On Friday, December 09, 2011 10:19:18 Don wrote:
> Are there any cases where you're using comma outside of for loops?
> I wonder how much would break if were made illegal everywhere else.
I'm sure that it would break code, but most people consider it bad practice to
use the comma operator for much outside of for loops. Occasionally, it's
useful to use one in an expression, but on the whole, it's just confusing and
error-prone. And while it might break code to make the comma operator illegal
outside of for loops, I would expect that fixing the broken code would
generally be rather trivial. The resulting code may not be as compact, but it
wouldn't be hard to write. And unless you're dealing with a programmer who
uses it uncommonly often, not much code is going to break.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list