comma operator causes hard to spot bugs
bearophile
bearophileHUGS at lycos.com
Sat Apr 21 09:54:48 PDT 2012
Jonathan M Davis:
> There have been discussions about the comma operator before. I
> don't expect that it's going anywhere,
Maybe there are intermediate solutions between keeping wild
commas in D and disallowing them fully. I think most of my bugs
caused by commas are similar to the one shown by the OP. This
means this is not a common source of bugs:
foo(), bar();
While this is sometimes a trap:
auto x = foo(), bar();
So maybe it's enough to disallow using the last expression of a
comma sequence as result of the whole expression? I don't know. I
almost never use commas for such purposes. What are the use case
for those commas?
Bye,
bearophile
More information about the Digitalmars-d
mailing list