[Top][All Lists]

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

Re: [Help-bash] declare -i

From: Dan Douglas
Subject: Re: [Help-bash] declare -i
Date: Tue, 08 May 2012 23:03:11 -0500
User-agent: KMail/4.8.3 (Linux/3.3.4-pf+; KDE/4.8.3; x86_64; ; )

On Tuesday, May 08, 2012 08:55:26 PM Bill Gradwohl wrote:

> Is there a write up somewhere that explains what exactly -i does internally?
> Are variables declared -i stored in binary?
> Is there any advantage or disadvantage to using -i for speed, memory 
efficiency, etc?
> Thank You
> -- 
> Bill Gradwohl

INTERNALLY? I believe they are stored in exactly the same way as any other
variable, they just get the -i attribute added as metadata. The ksh88 manpage
states that -i may be faster, but I believe in Bash it's actually slightly
slower, which makes sense because now all assignments are subject to an extra
evaluation step, and operators are modified such as the behavior of += in
several places.

Using -i can be an easy source of bugs and security problems, and adds a lot 
quirks especially with arrays.

-- Dan Douglas

Attachment: signature.asc
Description: This is a digitally signed message part.

reply via email to

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