Infer function template parameters
Jonathan M Davis
jmdavisProg at gmx.com
Mon Sep 24 10:25:38 PDT 2012
On Monday, September 24, 2012 19:18:09 Jonas Drewsen wrote:
> What about:
>
> int fun() {
> return (0, "abc")[0];
> }
>
> in the comma operator case it would return 'a' as an int.
> in the tuple case it would return 0
Like I said, I'd have to examine the situation more closely to be certain that
there are no places where C code would compile but change semantics. It looks
like you found one. That may or may not be enough to make it so that tuples
wouldn't be done that way. On rare occasions, C compatability has been broken
in this regard, but it's very rare. So, it's a very strong rule, but it's not
unbreakable.
Also, it's already been suggested in the thread on DIP 19 that we just give
different syntax to tuples to fix the problem. And it's not at all clear that
there's agreement that adding tuples to the language buys enough to make it
worth it anyway. So, who knows what will happen.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list