[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Can `declare -i` increase the performance of integer ari

From: Chet Ramey
Subject: Re: [Help-bash] Can `declare -i` increase the performance of integer arithmetic?
Date: Mon, 22 Jan 2018 09:28:52 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 1/22/18 8:48 AM, Peng Yu wrote:
>> No, it's not meant to improve performance.
> Then, what is the purpose of `declare -i`?

The purpose is as documented.

For assignment statements:

"If the variable has its integer attribute set, then value
is evaluated as an arithmetic expression even if the $((...)) expansion
is not used (see Arithmetic Expansion below)."

This has implications for how += is treated when applied to a variable
with the integer attribute set.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]