On 3 May 2013 20:24, Irek Szczesniak <[email protected]> wrote:
> On Fri, May 3, 2013 at 3:51 PM, David Korn <[email protected]> wrote:
>> Subject: Re: [ast-developers] (( x=$y )) warns about efficiency but $(( x=$y 
>> ))  does not
>> --------
>>
>>> Is there a reason why ksh -n triggers a warning (( x=$y )) about
>>> efficiency but $(( x=$y )) does not?
>>>
>>>
>>
>> In the second case, the shell has to do a conversion from number
>> to string anyway whereas in the first case no conversions are made
>> when y is already numeric for ((x == y)).
>
> The logic has one flaw: $((...)) converts the *result* to a string,
> but in (( x=$y )) and $(( x=$y )) the value of *y* is converted to a
> string, too. That's two times a string conversion is made. IMO a
> warning for an expansion of *y* in both (( x=$y )) and $(( x=$y )) is
> justified.

I have to agree with Irek.

Ced
-- 
Cedric Blancher <[email protected]>
Institute Pasteur
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to