On Monday, 24 March 2014 at 02:26:12 UTC, deadalnix wrote:
On Monday, 24 March 2014 at 01:36:46 UTC, bearophile wrote:
C code should not silently behave differently in D, even five years from now, so I am not interested in using the C comma syntax for D tuples. I am OK with a D tuple syntax that is not allowed in C.


It won't silently break. I concede it will break.

There are some corner cases where it might silently behave differently:

int a, b;
a, b = (1, 2);

This is apparently allowed in C, and will be equivalent to "b = 2;". But if we require parentheses, at least GCC 4.8.1 rejects it:

int a, b;
(a, b) = (1, 2);

tuple.c:3:8: error: lvalue required as left operand of assignment
 (a, b) = (1, 2);
        ^

So, with carefully tweaking the tuple syntax, we can probably reject any valid C code.

Reply via email to