Changing the behavior of the comma operator

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Mar 25 16:16:34 PDT 2014


On 3/25/14, 4:08 PM, H. S. Teoh wrote:
> On Tue, Mar 25, 2014 at 12:45:26PM -0700, Andrei Alexandrescu wrote:
>> On 3/25/14, 12:29 PM, captaindet wrote:
>>> mwould this effect comma usage inside for-loops as well or will this be
>>> special cased?
>>
>> Where inside for loops? -- Andrei
>
> 	for (x=1, y=2; x < 10 && y < 20; x++, y++) { ... }
>
> My opinion is to just special-case the syntax for for-loops.

The proposed change would allow the code above, but not this:

for (x=1, y=2; x++, x < 10 && y < 20; y++) { ... }


Andrei


More information about the Digitalmars-d mailing list