Changing the behavior of the comma operator
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Wed Mar 26 14:32:00 PDT 2014
On 3/26/2014 7:44 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
> On Tuesday, 25 March 2014 at 19:25:43 UTC, ixid wrote:
>>> I think this should not be done. Note that even though code which is
>>> D could reintroduce commas safely, C code will still exist at that
>>> time, and likely need porting to D. The principle that C code should
>>> either do the same thing, or not compile, would be violated.
>>
>> What would be an example of C code that would compile in a D
>> where the comma operator was used for tuples? Also why is cut and
>> pasting C code to D so important? If it's non-trivial surely
>> people will just use extern C. If it's trivial they can make the
>> minor improvements necessary.
>
> This is valid in both C and C++:
>
> i, j = 0, 1;
>
> It is equivalent to the following:
>
> i;
> j = 0;
> 1;
>
Under the proposal, the "0, 1" would be void, so it wouldn't compile in
D. Therefore, the rule about moving C code to D safely is not violated.
More information about the Digitalmars-d
mailing list