Multiple return values...
Iain Buclaw
ibuclaw at ubuntu.com
Fri Mar 16 02:03:43 PDT 2012
On 15 March 2012 17:51, Manu <turkeyman at gmail.com> wrote:
> On 15 March 2012 19:05, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>
> wrote:
>>
>> On 3/15/12 11:30 AM, Manu wrote:
>>>
>>> On 15 March 2012 17:32, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org <mailto:SeeWebsiteForEmail at erdani.org>>
>>>
>>> wrote:
>>> One note - the code is really ingenious, but I still prefer swap()
>>> in this case. It's more concise and does less work in the general
>>> case.
>>>
>>> swap(a[i + k], a[j + j]);
>>>
>>> only computes the indexing once (in source, too).
>>>
>>>
>>> It all still feels to me like a generally ugly hack around the original
>>> example:
>>> a,b = b,a;
>>
>>
>> It's a function call. Why is a function call a ugly hack?
>
>
> Because now we're involving libraries to perform a trivial assignment.
>
Question, what benefits would (a, b = b, a) bring over swap(a, b) if
it was included?
--
Iain Buclaw
*(p < e ? p++ : p) = (c & 0x0f) + '0';
More information about the Digitalmars-d
mailing list