Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: local variable setting problem/bug
- X-seq: zsh-workers 2434
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: rft@xxxxxxxxxxxxxxx
- Subject: Re: local variable setting problem/bug
- Date: Wed, 20 Nov 1996 02:41:57 +0100 (MET)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <9611192131.AA25535@xxxxxxxxxxxxxxxxxxxxx> from Robert F Tobler at "Nov 19, 96 10:31:39 pm"
> But even worse than that, try the following function:
>
> bug()
> {
> local a=()
> local b
> local c
> }
>
> On Nextstep 3.3 running zsh 3.00 or zsh 3.01 (with -f option) I get:
> zsh: 24224 segmentation fault zsh -f
>
> On Linux 1.3.52 running zsh 2.6-beta13 I get (after a while):
> zsh: fatal error: out of memory
>
> And on Irix 5.2 running zsh 3.00 it also consumes memory and
> won't terminate normally.
That's not surprising since local a=() in fact defined a function local and
a function a= which executed local b. So the function called local
recursively calls itself and there is not exit from this recursion. You
probably wanted to use it as
bug() {
local a
a=()
...
}
You cannot initialise local variables with an array at declaration. You
must use a separate assignment for that.
Zoltan
Messages sorted by:
Reverse Date,
Date,
Thread,
Author