Multiple return values...

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 9 07:29:49 PST 2012


On Fri, Mar 09, 2012 at 03:27:14PM +0100, Timon Gehr wrote:
> On 03/09/2012 01:23 AM, Manu wrote:
[...]
> >int x; ... (x, float y) = func(); // assign to predeclared variable(/s)?
> >(x, , z) = func(); // ignore the second result value (elimination of the
> >second result's code path)
> >
> 
> Those two would work, but (x,y) = func(); conflicts with the comma
> operator. (I'd prefer (,) to be a tuple constructor though.)

Just out of curiosity, *why* does D have a comma operator? It's one of
those obscure things about C that can be really, really, nasty if you're
unaware of it. And C++ makes it worse by making the comma operator
*overloadable*.


T

-- 
It's amazing how careful choice of punctuation can leave you hanging:


More information about the Digitalmars-d mailing list