Comma operator = broken design

Piotr Szturmaj bncrbme at jadamspam.pl
Fri Dec 9 05:15:22 PST 2011


Regan Heath wrote:
> On Fri, 09 Dec 2011 12:00:57 -0000, Timon Gehr <timon.gehr at gmx.ch> wrote:
>> On 12/09/2011 10:26 AM, Jonathan M Davis wrote:
>>> And unless you're dealing with a programmer who
>>> uses it uncommonly often, not much code is going to break.
>>
>> I _am_ such a programmer.
>
> So it seems :) I don't want to make your life harder but I think this
> change would make life easier for a large number of people [...]

What about just not using comma operator? Yes, I know about keyboard 
issue. There are many cases when 'typoed' code compiles but doesn't work 
as programmer would expect. This is not limited to comma op.

Some programmers do not like gotos, comma operator or other language 
constructs. Some like the opposites. I would suggest making a patch to 
the compiler to introduce a new pragma:

pragma(disable, commaOp);

and programmers will be able to place it in every source file they want to.


More information about the Digitalmars-d mailing list