comma operator causes hard to spot bugs
CTFE-4-the-win
CTFE at 4the.win
Mon Apr 23 02:38:48 PDT 2012
On Monday, 23 April 2012 at 08:08:52 UTC, Timon Gehr wrote:
> On 04/23/2012 01:56 AM, deadalnix wrote:
>> Le 21/04/2012 18:54, bearophile a écrit :
>>> 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();
>>>
>>
>> This is completely redundant with foo(); bar();
>
> Not completely, you also need { }
>
> if(qux()) foo(), bar();
>
>>
>> I see no benefit from being able to do this.
I think the most common use-case for the , operator is in the
"increment part" of for loops... but this could of course be
special-cased to still be allowed...
More information about the Digitalmars-d
mailing list